Revision 55a9b086
Added by Andreas Müller about 11 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/merge/DefaultMergeStrategy.java | ||
---|---|---|
14 | 14 |
import java.lang.reflect.Field; |
15 | 15 |
import java.lang.reflect.GenericDeclaration; |
16 | 16 |
import java.lang.reflect.Method; |
17 |
import java.lang.reflect.ParameterizedType; |
|
17 | 18 |
import java.lang.reflect.Type; |
19 |
import java.lang.reflect.TypeVariable; |
|
18 | 20 |
import java.util.ArrayList; |
19 | 21 |
import java.util.Collection; |
20 | 22 |
import java.util.HashMap; |
... | ... | |
26 | 28 |
|
27 | 29 |
import org.apache.log4j.Logger; |
28 | 30 |
|
29 |
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; |
|
30 |
import sun.reflect.generics.reflectiveObjects.TypeVariableImpl; |
|
31 | 31 |
import eu.etaxonomy.cdm.common.CdmUtils; |
32 | 32 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
33 | 33 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
... | ... | |
493 | 493 |
|
494 | 494 |
|
495 | 495 |
private static Class getCollectionType(Field field) throws MergeException{ |
496 |
Type genericType = (ParameterizedTypeImpl)field.getGenericType();
|
|
497 |
if (genericType instanceof ParameterizedTypeImpl){
|
|
498 |
ParameterizedTypeImpl paraType = (ParameterizedTypeImpl)genericType;
|
|
499 |
Class<?> rawType = paraType.getRawType();
|
|
496 |
Type genericType = (ParameterizedType)field.getGenericType(); |
|
497 |
if (genericType instanceof ParameterizedType/*Impl*/){
|
|
498 |
ParameterizedType paraType = (ParameterizedType)genericType;
|
|
499 |
Type rawType = paraType.getRawType();
|
|
500 | 500 |
Type[] arguments = paraType.getActualTypeArguments(); |
501 | 501 |
|
502 | 502 |
if (arguments.length == 1){ |
503 | 503 |
Class collectionClass; |
504 | 504 |
if (arguments[0] instanceof Class){ |
505 | 505 |
collectionClass = (Class)arguments[0]; |
506 |
}else if(arguments[0] instanceof TypeVariableImpl){
|
|
507 |
TypeVariableImpl typeVariable = (TypeVariableImpl)arguments[0];
|
|
506 |
}else if(arguments[0] instanceof TypeVariable/*Impl*/){
|
|
507 |
TypeVariable typeVariable = (TypeVariable)arguments[0];
|
|
508 | 508 |
GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration(); |
509 | 509 |
collectionClass = (Class)genericDeclaration; |
510 | 510 |
}else{ |
Also available in: Unified diff
Remove not public classes in merge and match strategies