use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project polymap4-core by Polymap4.
the class StyleCompositeSerializer method handle.
protected <V> Iterable<RuleModifier<V, S>> handle(Property<StylePropertyValue<V>> prop) {
StylePropertyValue<V> styleProp = prop.get();
// no value -> nothing to modify
if (styleProp == null || styleProp instanceof NoValue) {
return singletonList(new NoValueRuleModifier());
} else // ConstantValue
if (styleProp instanceof ConstantValue) {
Expression expr = ff.literal(((ConstantValue) styleProp).value());
return singletonList(new SimpleRuleModifier(expr));
} else // AttributeValue
if (styleProp instanceof AttributeValue) {
String attributeName = (String) ((AttributeValue) styleProp).attributeName.get();
Expression expr = ff.property(attributeName);
return singletonList(new SimpleRuleModifier(expr));
} else // FilterMappedValues
if (styleProp instanceof FilterMappedValues) {
List<Mapped<Filter, Object>> values = ((FilterMappedValues) styleProp).values();
return FluentIterable.from(values).transform(mapped -> new SimpleRuleModifier(ff.literal(mapped.value()), mapped.key()));
} else // ScaleMappedValues
if (styleProp instanceof ScaleMappedValues) {
List<Mapped<ScaleRange, Object>> values = ((ScaleMappedValues) styleProp).values();
return FluentIterable.from(values).transform(mapped -> new SimpleRuleModifier(ff.literal(mapped.value()), mapped.key().min.get(), mapped.key().max.get()));
} else {
throw new RuntimeException("Unhandled StylePropertyValue type: " + styleProp.getClass().getSimpleName());
}
}
use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.
the class AtlasTestData method generateAtlasProperties.
public static List<Property> generateAtlasProperties() {
List<Property> props = new ArrayList<Property>();
Property p = new Property();
p.setName("prop-boolean");
p.setValue("false");
p.setFieldType(FieldType.BOOLEAN);
props.add(p);
p = new Property();
p.setName("prop-byte");
p.setValue("92");
p.setFieldType(FieldType.BYTE);
props.add(p);
p = new Property();
p.setName("prop-char");
p.setValue("z");
p.setFieldType(FieldType.CHAR);
props.add(p);
p = new Property();
p.setName("prop-double");
p.setValue(Double.toString(Double.MIN_VALUE));
p.setFieldType(FieldType.DOUBLE);
props.add(p);
p = new Property();
p.setName("prop-float");
p.setValue(Float.toString(Float.MIN_VALUE));
p.setFieldType(FieldType.FLOAT);
props.add(p);
p = new Property();
p.setName("prop-int");
p.setValue(Integer.toString(Integer.MIN_VALUE));
p.setFieldType(FieldType.INTEGER);
props.add(p);
p = new Property();
p.setName("prop-long");
p.setValue(Long.toString(Long.MIN_VALUE));
p.setFieldType(FieldType.LONG);
props.add(p);
p = new Property();
p.setName("prop-short");
p.setValue(Short.toString(Short.MIN_VALUE));
p.setFieldType(FieldType.SHORT);
props.add(p);
p = new Property();
p.setName("prop-string");
p.setValue("helloworld");
p.setFieldType(FieldType.STRING);
props.add(p);
p = new Property();
p.setName("dupe-string");
p.setValue("whatup");
p.setFieldType(FieldType.STRING);
props.add(p);
return props;
}
use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateProperties.
private void generateProperties(AtlasMapping atlasMapping) {
Property p = new Property();
p.setName("foo");
p.setValue("bar");
p.setFieldType(FieldType.INTEGER);
atlasMapping.setProperties(new Properties());
atlasMapping.getProperties().getProperty().add(p);
}
use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateProperties.
private void generateProperties(AtlasMapping atlasMapping) {
Property p = new Property();
p.setName("foo");
p.setValue("bar");
p.setFieldType(FieldType.INTEGER);
atlasMapping.setProperties(new Properties());
atlasMapping.getProperties().getProperty().add(p);
}
use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateProperties.
private void generateProperties(AtlasMapping mapping) {
Property p = new Property();
p.setName("foo");
p.setValue("bar");
p.setFieldType(FieldType.INTEGER);
mapping.setProperties(new Properties());
mapping.getProperties().getProperty().add(p);
}
Aggregations