Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/705#discussion_r33194180
--- Diff: core/src/main/java/brooklyn/util/flags/TypeCoercions.java ---
@@ -723,7 +727,31 @@ public Class apply(final String input) {
registerAdapter(String.class, AttributeSensor.class, new
Function<String,AttributeSensor>() {
@Override
public AttributeSensor apply(final String input) {
- return new BasicAttributeSensor<Object>(Object.class,
input);
+ Entity entity =
BrooklynTaskTags.getContextEntity(Tasks.current());
+ if (entity!=null) {
+ Sensor<?> result = null;
+ if (entity!=null) {
+ result = entity.getEntityType().getSensor(input);
+ if (result instanceof AttributeSensor)
+ return (AttributeSensor) result;
+ }
+ }
+ return Sensors.newSensor(Object.class, input);
+ }
+ });
+ registerAdapter(String.class, Sensor.class, new
Function<String,Sensor>() {
+ @Override
+ public AttributeSensor apply(final String input) {
+ Entity entity =
BrooklynTaskTags.getContextEntity(Tasks.current());
+ if (entity!=null) {
+ Sensor<?> result = null;
+ if (entity!=null) {
--- End diff --
who wrote this mess? :)
---
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.
---