mirror of
https://github.com/apache/openjpa.git
synced 2025-03-06 16:39:11 +00:00
Add constructor for more flexible signature
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@899532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
342c27dfd5
commit
ab032d8f73
@ -120,8 +120,23 @@ public interface FillStrategy<T> {
|
||||
try {
|
||||
return cls.getConstructor(types);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(_loc.get("fill-ctor-none", cls, Arrays.toString(types)).getMessage());
|
||||
Constructor<?>[] constructors = cls.getConstructors();
|
||||
for (Constructor<?> cons : constructors) {
|
||||
Class<?>[] paramTypes = cons.getParameterTypes();
|
||||
boolean match = false;
|
||||
if (paramTypes.length == types.length) {
|
||||
for (int i = 0; i < paramTypes.length; i++) {
|
||||
match = paramTypes[i].isAssignableFrom(Filters.wrap(types[i]));
|
||||
if (!match)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
return (Constructor<X>)cons;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(_loc.get("fill-ctor-none", cls, Arrays.toString(types)).getMessage());
|
||||
}
|
||||
|
||||
public T fill(Object[] values, Class<?>[] types, String[] aliases) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user