use of org.geotoolkit.wps.xml.v200.LiteralValue in project geotoolkit by Geomatys.
the class LiteralAdaptorTest method doubleWPS2.
@Test
public void doubleWPS2() {
final DomainMetadataType metaType = new DomainMetadataType(null, "xs:double");
final LiteralDataDomain domain = new LiteralDataDomain();
domain.setDataType(metaType);
final LiteralAdaptor adaptor = LiteralAdaptor.create(domain);
assertEquals(Double.class, adaptor.getValueClass());
final DataOutput output = new DataOutput();
final LiteralValue lit = new LiteralValue();
lit.setValue("3.14");
final Data data = new Data(lit);
output.setData(data);
final Object result = adaptor.fromWPS2Input(output);
assertEquals(3.14, (Double) result, DELTA);
}
use of org.geotoolkit.wps.xml.v200.LiteralValue in project geotoolkit by Geomatys.
the class LiteralAdaptor method toWPS2Input.
public DataInput toWPS2Input(Object candidate, boolean rawLiteral) {
final Data data = new Data();
final LiteralValue litValue = new LiteralValue();
litValue.setDataType(WPSConvertersUtils.getDataTypeString("2.0.0", getValueClass()));
litValue.setValue(String.valueOf(candidate));
litValue.setUom(unit == null ? null : unit.getName());
if (rawLiteral) {
data.getContent().add(String.valueOf(candidate));
} else {
data.getContent().add(litValue);
}
final DataInput dit = new DataInput();
dit.setData(data);
return dit;
}
Aggregations