Class TypeHelper
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.TypeHelper
-
public class TypeHelper extends java.lang.ObjectGeneric type operations.- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTypeHelper()Prevents external instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IMetaOperationfindConversion(IMetaType argType, IMetaType paramType)Tries to find a conversion among the given types.static <O extends IMetaOperation>
OgetMoreSpecificParam1(O op1, O op2)Returns the more specific operation based on the first parameter.static <T extends java.lang.annotation.Annotation>
TgetParameterAnnotation(java.lang.annotation.Annotation[][] annotations, int index, java.lang.Class<T> cls)Returns the QM generic annotation if defined.static booleanisBasicType(java.lang.Class<?> cls)Returns whether the givenclsrepresents a basic type.
-
-
-
Method Detail
-
getMoreSpecificParam1
public static final <O extends IMetaOperation> O getMoreSpecificParam1(O op1, O op2)
Returns the more specific operation based on the first parameter.- Type Parameters:
O- the type of the operation class- Parameters:
op1- the first operationop2- the second operation- Returns:
op1if the type of the first parameter ofop1is more specific than the type of the first parameter ofop2op2if the type of the first parameter ofop2is more specific than the type of the first parameter ofop1op1if the type of the first parameter ofop1is not a basic type while the first parameter ofop2is a basic typeop2if the type of the first parameter ofop2is not a basic type while the first parameter ofop1is a basic typeop2ifop1is nullop1ifop2is nullop1in any other case
-
findConversion
public static IMetaOperation findConversion(IMetaType argType, IMetaType paramType)
Tries to find a conversion among the given types. Defined conversions on both types are taken into account.- Parameters:
argType- the argument typeparamType- the parameter type- Returns:
- the conversion operation or null if there is none
-
isBasicType
public static boolean isBasicType(java.lang.Class<?> cls)
Returns whether the givenclsrepresents a basic type.- Parameters:
cls- the class to be tested- Returns:
trueifclsrepresents a basic type,falseelse
-
getParameterAnnotation
public static <T extends java.lang.annotation.Annotation> T getParameterAnnotation(java.lang.annotation.Annotation[][] annotations, int index, java.lang.Class<T> cls)Returns the QM generic annotation if defined.- Type Parameters:
T- the annotation type to search for- Parameters:
annotations- the parameter annotations to considerindex- the index of the parametercls- the annotation class to return- Returns:
- the annotation or null
-
-