use of org.osate.aadl2.Property in project atlasmap by atlasmap.
the class DefaultAtlasFieldActionService method detectFieldActionParameters.
protected Properties detectFieldActionParameters(String actionClassName) throws ClassNotFoundException {
Class<?> actionClazz = Class.forName(actionClassName);
Properties props = null;
for (Method method : actionClazz.getMethods()) {
// Find setters to avoid the get / is confusion
if (method.getParameterCount() == 1 && method.getName().startsWith("set")) {
// We have a parameter
if (props == null) {
props = new Properties();
}
Property prop = null;
for (Parameter param : method.getParameters()) {
prop = new Property();
prop.setName(camelize(method.getName().substring("set".length())));
prop.setFieldType(getConversionService().fieldTypeFromClass(param.getType()));
props.getProperty().add(prop);
}
}
}
return props;
}
use of org.osate.aadl2.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.osate.aadl2.Property in project atlasmap by atlasmap.
the class DefaultAtlasFieldActionsServiceTest method testListActionDetails.
@Test
public void testListActionDetails() {
assertNotNull(fieldActionsService);
List<ActionDetail> actionDetails = fieldActionsService.listActionDetails();
for (ActionDetail d : actionDetails) {
if (d.getParameters() != null) {
System.out.println("Action: " + d.getName());
for (Property prop : d.getParameters().getProperty()) {
System.out.println("\t param: " + prop.getName());
System.out.println("\t type: " + prop.getFieldType().value());
}
}
}
}
use of org.osate.aadl2.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.osate.aadl2.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;
}
Aggregations