in lightning-core/src/main/java/org/apache/directmemory/lightning/internal/util/BeanUtil.java [70:99]
public static Set<Field> findPropertiesByMethods( Class<?> type, Class<?> searchType,
Class<? extends Annotation> attributeAnnotation )
{
Set<Field> attributes = new HashSet<Field>();
for ( Method method : searchType.getDeclaredMethods() )
{
if ( method.isAnnotationPresent( attributeAnnotation ) )
{
String propertyName = BeanUtil.buildPropertyName( method );
Field field = BeanUtil.getFieldByPropertyName( propertyName, type );
if ( field == null )
{
if ( attributeAnnotation == Attribute.class )
{
Attribute attribute = method.getAnnotation( Attribute.class );
field = BeanUtil.getFieldByPropertyName( attribute.property(), type );
}
if ( field == null )
{
throw new SerializerDefinitionException( "No property for method " + method + " was found" );
}
}
attributes.add( field );
}
}
return attributes;
}