|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* Copyright 2002-2014 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -50,12 +50,12 @@ public class ReflectiveConstructorResolver implements ConstructorResolver { |
|
|
|
* </ol> |
|
|
|
* </ol> |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ConstructorExecutor resolve(EvaluationContext context, String typename, List<TypeDescriptor> argumentTypes) |
|
|
|
public ConstructorExecutor resolve(EvaluationContext context, String typeName, List<TypeDescriptor> argumentTypes) |
|
|
|
throws AccessException { |
|
|
|
throws AccessException { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
TypeConverter typeConverter = context.getTypeConverter(); |
|
|
|
TypeConverter typeConverter = context.getTypeConverter(); |
|
|
|
Class<?> type = context.getTypeLocator().findType(typename); |
|
|
|
Class<?> type = context.getTypeLocator().findType(typeName); |
|
|
|
Constructor<?>[] ctors = type.getConstructors(); |
|
|
|
Constructor<?>[] ctors = type.getConstructors(); |
|
|
|
|
|
|
|
|
|
|
|
Arrays.sort(ctors, new Comparator<Constructor<?>>() { |
|
|
|
Arrays.sort(ctors, new Comparator<Constructor<?>>() { |
|
|
|
@ -63,7 +63,7 @@ public class ReflectiveConstructorResolver implements ConstructorResolver { |
|
|
|
public int compare(Constructor<?> c1, Constructor<?> c2) { |
|
|
|
public int compare(Constructor<?> c1, Constructor<?> c2) { |
|
|
|
int c1pl = c1.getParameterTypes().length; |
|
|
|
int c1pl = c1.getParameterTypes().length; |
|
|
|
int c2pl = c2.getParameterTypes().length; |
|
|
|
int c2pl = c2.getParameterTypes().length; |
|
|
|
return (new Integer(c1pl)).compareTo(c2pl); |
|
|
|
return (c1pl < c2pl ? -1 : (c1pl > c2pl ? 1 : 0)); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|