Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/821#discussion_r142359688
--- Diff:
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/BrooklynRestResourceUtils.java
---
@@ -130,6 +143,36 @@ public Policy getPolicy(Entity entity, String policy) {
throw WebResourceUtils.notFound("Cannot find policy '%s' in entity
'%s'", policy, entity);
}
+
+ /** finds the policy indicated by the given ID or name.
+ * @see {@link #getAdjunct(String,String,String)}.
+ * <p>
+ *
+ * @throws 404 or 412 (unless input is null in which case output is
null) */
+ public EntityAdjunct getAdjunct(Entity entity, String adjunct) {
+ if (adjunct==null) return null;
--- End diff --
let's make it separate just in case -- agree no use case for `null` input.
i'd probably make it a fail-fast NPE (500 or 412 precondition failed) rather
than a 404.
---