target.getMethodList.add(mi);
} else {
String msg = String.format(
"Only scope in [%s] can be marked as reverse injectable but found scope as %s (%s:%s).",
reverseTargetScopes.toString(), mi.scope, cls.getName(), mi.name);
Asta4DWarningException awe = new Asta4DWarningException(msg);
logger.warn(msg, awe);
}
}
}
if (isSet) {
mi.type = method.getParameterTypes()[0];
mi.isContextDataHolder = ContextDataHolder.class.isAssignableFrom(mi.type);
mi.fixForPrimitiveType();
ContextDataSet cdSet = ConvertableAnnotationRetriever
.retrieveAnnotation(ContextDataSet.class, mi.type.getAnnotations());
if (cdSet == null) {
mi.contextDataSetFactory = null;
} else {
mi.contextDataSetFactory = cdSet.factory().newInstance();
mi.isContextDataSetSingletonInContext = cdSet.singletonInContext();
}
target.setMethodList.add(mi);
}
}
}
// then retrieve fields information
String objCls = Object.class.getName();
Field[] flds;
FieldInfo fi;
while (!cls.getName().equals(objCls)) {
flds = cls.getDeclaredFields();
for (Field field : flds) {
cd = ConvertableAnnotationRetriever.retrieveAnnotation(ContextData.class, field.getAnnotations());
if (cd != null) {
fi = new FieldInfo();
fi.field = field;
fi.type = field.getType();
fi.isContextDataHolder = ContextDataHolder.class.isAssignableFrom(fi.type);
String delcaredName = cd == null ? "" : cd.name();
if (StringUtils.isEmpty(delcaredName)) {
fi.name = field.getName();
} else {
fi.name = cd.name();
}
fi.scope = cd == null ? "" : cd.scope();
fi.typeUnMatch = cd.typeUnMatch();
fi.fixForPrimitiveType();
ContextDataSet cdSet = ConvertableAnnotationRetriever
.retrieveAnnotation(ContextDataSet.class, fi.type.getAnnotations());
if (cdSet == null) {
fi.contextDataSetFactory = null;
} else {
fi.contextDataSetFactory = cdSet.factory().newInstance();
fi.isContextDataSetSingletonInContext = cdSet.singletonInContext();
}
target.setFieldList.add(fi);
if (cd.reverse()) {//
if (reverseTargetScopes.contains(fi.scope)) {
target.getFieldList.add(fi);
} else {
String msg = String.format(
"Only scope in [%s] can be marked as reverse injectable but found scope as %s (%s:%s).",
reverseTargetScopes.toString(), fi.scope, cls.getName(), fi.name);
Asta4DWarningException awe = new Asta4DWarningException(msg);
logger.warn(msg, awe);
}
}
}