Github user geomacy commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/746#discussion_r126401057
--- Diff:
core/src/main/java/org/apache/brooklyn/core/typereg/RegisteredTypes.java ---
@@ -125,21 +178,52 @@ public static RegisteredType bean(@Nonnull String
symbolicName, @Nonnull String
}
/** Convenience for {@link #bean(String, String,
TypeImplementationPlan)} when there is a single known java signature/super type
*/
public static RegisteredType bean(@Nonnull String symbolicName,
@Nonnull String version, @Nonnull TypeImplementationPlan plan, @Nonnull
Class<?> superType) {
- if (superType==null) log.warn("Deprecated use of RegisteredTypes
API passing null name/version", new Exception("Location of deprecated use, wrt
"+symbolicName+":"+version+" "+plan));
+ if (superType==null) log.warn("Deprecated use of RegisteredTypes
API passing null supertype", new Exception("Location of deprecated use, wrt
"+symbolicName+":"+version+" "+plan));
return addSuperType(bean(symbolicName, version, plan), superType);
}
/** Preferred mechanism for defining a spec {@link RegisteredType}.
* Callers should also {@link #addSuperTypes(RegisteredType,
Iterable)} on the result.*/
public static RegisteredType spec(@Nonnull String symbolicName,
@Nonnull String version, @Nonnull TypeImplementationPlan plan) {
- if (symbolicName==null || version==null) log.warn("Deprecated use
of RegisteredTypes API passing null name/version", new Exception("Location of
deprecated use, wrt "+plan));
+ if (symbolicName==null || version==null) log.warn("Deprecated use
of RegisteredTypes API passing null supertype", new Exception("Location of
deprecated use, wrt "+plan));
return new BasicRegisteredType(RegisteredTypeKind.SPEC,
symbolicName, version, plan);
}
- /** Convenience for {@link #cpec(String, String,
TypeImplementationPlan)} when there is a single known java signature/super type
*/
+ /** Convenience for {@link #spec(String, String,
TypeImplementationPlan)} when there is a single known java signature/super type
*/
public static RegisteredType spec(@Nonnull String symbolicName,
@Nonnull String version, @Nonnull TypeImplementationPlan plan, @Nonnull
Class<?> superType) {
- if (superType==null) log.warn("Deprecated use of RegisteredTypes
API passing null name/version", new Exception("Location of deprecated use, wrt
"+symbolicName+":"+version+" "+plan));
+ if (superType==null) log.warn("Deprecated use of RegisteredTypes
API passing null supertype", new Exception("Location of deprecated use, wrt
"+symbolicName+":"+version+" "+plan));
return addSuperType(spec(symbolicName, version, plan), superType);
}
+ public static RegisteredType newInstance(@Nonnull RegisteredTypeKind
kind, @Nonnull String symbolicName, @Nonnull String version,
--- End diff --
Maybe worth introducing a Builder, for readability at the call site.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---