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 ; }
Obtain the valueTypes of the ObjectTypeAttributeDefinition through reflection because they are private in Wildfly 8 .