Search in sources :

Example 6 with FieldDescriptor

use of jodd.introspector.FieldDescriptor in project jodd by oblac.

the class TypeJsonVisitor method visit.

/**
	 * Visits a type.
	 */
public void visit() {
    ClassDescriptor classDescriptor = ClassIntrospector.lookup(type);
    if (classMetadataName != null) {
        // process first 'meta' fields 'class'
        onProperty(classMetadataName, null, false);
    }
    PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();
    for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
        Getter getter = propertyDescriptor.getGetter(declared);
        if (getter != null) {
            String propertyName = propertyDescriptor.getName();
            boolean isTransient = false;
            // check for transient flag
            FieldDescriptor fieldDescriptor = propertyDescriptor.getFieldDescriptor();
            if (fieldDescriptor != null) {
                isTransient = Modifier.isTransient(fieldDescriptor.getField().getModifiers());
            }
            onProperty(propertyName, propertyDescriptor, isTransient);
        }
    }
}
Also used : ClassDescriptor(jodd.introspector.ClassDescriptor) PropertyDescriptor(jodd.introspector.PropertyDescriptor) Getter(jodd.introspector.Getter) FieldDescriptor(jodd.introspector.FieldDescriptor)

Aggregations

FieldDescriptor (jodd.introspector.FieldDescriptor)6 ClassDescriptor (jodd.introspector.ClassDescriptor)5 MethodDescriptor (jodd.introspector.MethodDescriptor)5 PropertyDescriptor (jodd.introspector.PropertyDescriptor)5 ArrayList (java.util.ArrayList)4 PetiteInject (jodd.petite.meta.PetiteInject)2 Annotation (java.lang.annotation.Annotation)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Collection (java.util.Collection)1 Getter (jodd.introspector.Getter)1 PropertyInjectionPoint (jodd.petite.PropertyInjectionPoint)1 SetInjectionPoint (jodd.petite.SetInjectionPoint)1