use of org.jboss.as.controller.ObjectTypeAttributeDefinition in project camunda-bpm-platform by camunda.
the class CustomMarshaller method getValueTypes.
/**
* Obtain the 'valueTypes' of the ObjectTypeAttributeDefinition through reflection because they are private in Wildfly 8.
*/
public static AttributeDefinition[] getValueTypes(Object instance, Class clazz) {
try {
if (ObjectTypeAttributeDefinition.class.isAssignableFrom(clazz)) {
Field valueTypesField = clazz.getDeclaredField("valueTypes");
valueTypesField.setAccessible(true);
Object value = valueTypesField.get(instance);
if (value != null) {
if (AttributeDefinition[].class.isAssignableFrom(value.getClass())) {
return (AttributeDefinition[]) value;
}
}
return (AttributeDefinition[]) value;
}
} catch (Exception e) {
throw new RuntimeException("Unable to get valueTypes.", e);
}
return null;
}
Aggregations