boon/src/main/java/org/boon/core/reflection/Annotations.java
private static Annotation[] findPropertyAnnotations( Class<?> clazz, String propertyName, boolean useRead )
            throws IntrospectionException {

        PropertyDescriptor propertyDescriptor = getPropertyDescriptor( clazz, propertyName );
        if ( propertyDescriptor == null ) {
            return new Annotation[]{ };
        }
        Method accessMethod = null;

        if ( useRead ) {
            accessMethod = propertyDescriptor.getReadMethod();
        } else {
            accessMethod = propertyDescriptor.getWriteMethod();
        }

        if ( accessMethod != null ) {
            Annotation[] annotations = accessMethod.getAnnotations();
            return annotations;
        } else {
            return new Annotation[]{ };
        }
    }
private static Annotation[] findPropertyAnnotations( Class<?> clazz, String propertyName, boolean useRead )
            throws IntrospectionException {

        PropertyDescriptor propertyDescriptor = getPropertyDescriptor( clazz, propertyName );
        if ( propertyDescriptor == null ) {
            return new Annotation[]{ };
        }
        Method accessMethod = null;

        if ( useRead ) {
            accessMethod = propertyDescriptor.getReadMethod();
        } else {
            accessMethod = propertyDescriptor.getWriteMethod();
        }

        if ( accessMethod != null ) {
            Annotation[] annotations = accessMethod.getAnnotations();
            return annotations;
        } else {
            return new Annotation[]{ };
        }
    }
private static Annotation [ ] findPropertyAnnotations ( Class < ? > clazz , String propertyName , boolean useRead ) throws IntrospectionException { PropertyDescriptor propertyDescriptor = getPropertyDescriptor ( clazz , propertyName ) ; if ( propertyDescriptor == null ) { return new Annotation [ ] { } ; } Method accessMethod = null ; if ( useRead ) { accessMethod = propertyDescriptor . getReadMethod ( ) ; } else { accessMethod = propertyDescriptor . getWriteMethod ( ) ; } if ( accessMethod != null ) { Annotation [ ] annotations = accessMethod . getAnnotations ( ) ; return annotations ; } else { return new Annotation [ ] { } ; } }
Find annotation given a particular property name and clazz. This figures
out the writeMethod for the property, and uses the write method
to look up the annotation.

@param clazz        The class that holds the property.
@param propertyName The name of the property.
@return
@throws java.beans.IntrospectionException
Find annotation given a particular property name and clazz . This figures out the writeMethod for the property and uses the write method to look up the annotation .