use of org.simpleflatmapper.reflect.InstantiatorDefinition in project SimpleFlatMapper by arnaudroger.
the class InstantiatorDefinitions method lookForCompatibleOneArgument.
public static InstantiatorDefinition lookForCompatibleOneArgument(Collection<InstantiatorDefinition> col, CompatibilityScorer scorer) {
InstantiatorDefinition current = null;
int currentScore = -1;
for (InstantiatorDefinition id : col) {
if (id.getParameters().length == 1) {
int score = scorer.score(id);
if (score > currentScore) {
current = id;
currentScore = score;
}
}
}
return current;
}
use of org.simpleflatmapper.reflect.InstantiatorDefinition in project SimpleFlatMapper by arnaudroger.
the class ObjectClassMeta method listConstructorProperties.
private List<ConstructorPropertyMeta<T, ?>> listConstructorProperties(List<InstantiatorDefinition> instantiatorDefinitions, boolean builderIgnoresNullValues) {
if (instantiatorDefinitions == null)
return null;
List<ConstructorPropertyMeta<T, ?>> constructorProperties = new ArrayList<ConstructorPropertyMeta<T, ?>>();
ParamNameDeductor<T> paramNameDeductor = null;
for (InstantiatorDefinition cd : instantiatorDefinitions) {
for (org.simpleflatmapper.reflect.Parameter param : cd.getParameters()) {
String paramName = param.getName();
if (paramName == null) {
if (paramNameDeductor == null) {
paramNameDeductor = new ParamNameDeductor<T>(TypeHelper.<T>toClass(target));
}
paramName = paramNameDeductor.findParamName(cd, param, builderIgnoresNullValues);
}
constructorProperties.add(constructorMeta(param, paramName, cd));
}
}
return constructorProperties;
}
Aggregations