}
Collection<Class<? extends Annotation>> annotationClasses = (annotations != null ? Arrays.asList(annotations.value()) : null);
// class
ClassInfo classInfo = info.getClassInfo();
for(T plugin : getPlugins(ElementType.TYPE, null, annotationClasses))
{
if (isApplyPhase)
applyPlugin(plugin, classInfo, retrieval, handle);
else
cleanPlugin(plugin, classInfo, retrieval, handle);
}
// constructors
Set<ConstructorInfo> constructors = info.getConstructors();
if (constructors != null && constructors.isEmpty() == false)
{
for(ConstructorInfo ci : constructors)
{
Signature cis = new ConstructorSignature(ci);
MetaData cmdr = retrieval.getComponentMetaData(cis);
if (cmdr != null)
{
for(T plugin : getPlugins(ElementType.CONSTRUCTOR, null, annotationClasses))
{
if (isApplyPhase)
applyPlugin(plugin, ci, cmdr, handle);
else
cleanPlugin(plugin, ci, cmdr, handle);
}
}
else if (trace)
log.trace("No annotations for " + ci);
}
}
else if (trace)
log.trace("No constructors");
// properties
Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
Set<PropertyInfo> properties = info.getProperties();
if (properties != null && properties.isEmpty() == false)
{
for(PropertyInfo pi : properties)
{
FieldInfo field = pi.getFieldInfo();
if (field != null)
{
Signature sis = new FieldSignature(field);
MetaData cmdr = retrieval.getComponentMetaData(sis);
if (cmdr != null)
{
for(T plugin : getPlugins(ElementType.FIELD, null, annotationClasses))
{
if (isApplyPhase)
applyPlugin(plugin, field, cmdr, handle);
else
cleanPlugin(plugin, field, cmdr, handle);
}
}
else if (trace)
log.trace("No annotations for field " + field.getName());
}
// apply setter and getter as well - if they exist
handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getSetter(), "setter", annotationClasses);
handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getGetter(), "getter", annotationClasses);
}
}
else if (trace)
log.trace("No properties");
// get Object's class info - it's cached so it shouldn't take much
TypeInfoFactory tif = classInfo.getTypeInfoFactory();
TypeInfo objectTI = tif.getTypeInfo(Object.class);
// method plugins
Iterable<T> methodPlugins = null;
// methods
Set<MethodInfo> methods = info.getMethods();
if (methods != null && methods.isEmpty() == false)
{
for(MethodInfo mi : methods)
{
ClassInfo declaringCI = mi.getDeclaringClass();
// direct == check is OK
if (declaringCI != objectTI && visitedMethods.contains(mi) == false)
{
Signature mis = new DeclaredMethodSignature(mi);
MetaData cmdr = retrieval.getComponentMetaData(mis);