Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/1017#discussion_r45041122
--- Diff:
api/src/main/java/org/apache/brooklyn/api/typereg/BrooklynTypeRegistry.java ---
@@ -45,24 +45,25 @@
/** @return The item matching the given given
* {@link RegisteredType#getSymbolicName() symbolicName}
* and optionally {@link RegisteredType#getVersion()},
- * filtered for the optionally supplied {@link
RegisteredTypeConstraint},
+ * filtered for the optionally supplied {@link
RegisteredTypeLoadingContext},
* taking the best version if the version is null or a default marker,
* returning null if no matches are found. */
- RegisteredType get(String symbolicName, String version, @Nullable
RegisteredTypeConstraint constraint);
- /** as {@link #get(String, String, RegisteredTypeConstraint)} with no
constraints */
+ RegisteredType get(String symbolicName, String version, @Nullable
RegisteredTypeLoadingContext constraint);
+ /** as {@link #get(String, String, RegisteredTypeLoadingContext)} with
no constraints */
RegisteredType get(String symbolicName, String version);
- /** as {@link #get(String, String, RegisteredTypeConstraint)} but
allows <code>"name:version"</code>
+ /** as {@link #get(String, String, RegisteredTypeLoadingContext)} but
allows <code>"name:version"</code>
* (the {@link RegisteredType#getId()}) in addition to the unversioned
name,
* using a default marker if no version can be inferred */
- RegisteredType get(String symbolicNameWithOptionalVersion, @Nullable
RegisteredTypeConstraint constraint);
- /** as {@link #get(String, RegisteredTypeConstraint)} but with no
constraints */
+ RegisteredType get(String symbolicNameWithOptionalVersion, @Nullable
RegisteredTypeLoadingContext constraint);
--- End diff --
You're right.
In general it serves a few purposes:
* it supplies class-loading context
* it helps with recursive resolution (`alreadyEncounteredType`)
* it prevents returning incompatible classes
But none of them are needed for a lookup. Maybe we should remove; I'll
look at that.
BTW correct that we don't allow different instances of the same symbolic
name+version. However i have in my mind a concept of `aliases` which types
could declare, and those could conflict, so if looking up an alias the context
could be useful.
---
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.
---