Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/300#discussion_r75291636
--- Diff:
camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
---
@@ -84,51 +89,72 @@ public DslComponent(DslComponent scopeComponent, Scope
scope, String componentId
}
// ---------------------------
-
+
@Override
- public Task<Entity> newTask() {
- return
TaskBuilder.<Entity>builder().displayName(toString()).tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
- .body(new EntityInScopeFinder(scopeComponent, scope,
componentId)).build();
+ public Task<O> newTask() {
+ return TaskBuilder.<O>builder()
+ .displayName(toString())
+ .tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
+ .body(new ObjectInScopeFinder(scopeComponent, scope,
componentId))
+ .build();
}
-
- protected static class EntityInScopeFinder implements Callable<Entity>
{
+
+ protected static class ObjectInScopeFinder<O> implements Callable<O> {
protected final DslComponent scopeComponent;
protected final Scope scope;
protected final String componentId;
- public EntityInScopeFinder(DslComponent scopeComponent, Scope
scope, String componentId) {
+ public ObjectInScopeFinder(DslComponent scopeComponent, Scope
scope, String componentId) {
this.scopeComponent = scopeComponent;
this.scope = scope;
this.componentId = componentId;
}
protected EntityInternal getEntity() {
if (scopeComponent!=null) {
- return (EntityInternal)scopeComponent.get();
+ return (EntityInternal) scopeComponent.get();
--- End diff --
Seems strange to cast this to `EntityInternal`, now that you've generalised
it to `ObjectInScopeFinder`.
---
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.
---