Class Signature
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.spi.Signature
-
@Immutable public final class Signature extends java.lang.Object
Represents the signature of a method, which is sometimes needed for selecting the correct method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSignature.CallType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Type>argTypes()private voidcheckArgTypeCompatibility(java.util.List<Type> atypes)private booleancheckArgTypeCompatibility(java.util.List<Type> atypes, boolean throwsException)voidcheckCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args)Check whether the list of expression in args is statically compatible with this Signature.private voidcheckCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args, boolean isStaticMethod)voidcheckConstructorCompatibility(Type targetType, java.util.List<Expression> args)Check whether the list of expression in args is statically compatible with this Signature.voidcheckStaticCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args)Check whether the list of expression in args is statically compatible with this Signature.java.lang.StringdisplayAsMethod()java.lang.StringdisplayAsMethod(java.lang.String methodName)booleanequals(java.lang.Object obj)static SignaturefromCall(Type type, java.lang.String ident, java.util.List<Expression> exprs)static SignaturefromCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types)static SignaturefromConstructor(Type type, java.util.List<Expression> exprs)static SignaturefromConstructorUsingTypes(Type type, java.util.List<Type> types)private static SignaturefromMethodCall(Type type, java.lang.String ident, java.util.List<Expression> exprs, boolean isStaticCall)private static SignaturefromMethodCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types, boolean isStaticCall)static SignaturefromStaticCall(Type type, java.lang.String ident, java.util.List<Expression> exprs)static SignaturefromStaticCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types)private static java.lang.StringgetCallTypeString(Signature.CallType ct, java.lang.String ident)private static ClassInfogetClassInfo(Type type)private static java.util.Set<MethodInfo>getCompatibleMethods(java.util.Set<MethodInfo> methods, java.util.List<Type> argTypes)(package private) static java.util.List<Type>getExprTypes(java.util.List<Expression> exprs)private static java.lang.StringgetMethodListString(java.util.Set<MethodInfo> mlist)private static java.util.Set<MethodInfo>getMethods(Type type, java.lang.String ident, boolean staticOnly)private static java.lang.StringgetTypeListString(java.util.List<Type> types)inthashCode()static Signaturemake(Type rtype, java.util.List<Type> types)private static MethodInforeturnCompatibleMethod(Type type, java.lang.String ident, java.util.List<Type> argTypes, Signature.CallType ctype, java.util.Set<MethodInfo> compatibleMethods)TypereturnType()java.lang.Stringsignature()private static java.lang.Stringsprintf(java.lang.String format, java.lang.Object... args)java.lang.StringtoString()
-
-
-
Method Detail
-
returnType
public Type returnType()
-
argTypes
public java.util.List<Type> argTypes()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
signature
public java.lang.String signature()
-
displayAsMethod
public java.lang.String displayAsMethod()
-
displayAsMethod
public java.lang.String displayAsMethod(java.lang.String methodName)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
checkArgTypeCompatibility
private void checkArgTypeCompatibility(java.util.List<Type> atypes)
-
checkArgTypeCompatibility
private boolean checkArgTypeCompatibility(java.util.List<Type> atypes, boolean throwsException)
-
getExprTypes
static java.util.List<Type> getExprTypes(java.util.List<Expression> exprs)
-
checkCompatibility
private void checkCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args, boolean isStaticMethod)
-
checkCompatibility
public void checkCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args)
Check whether the list of expression in args is statically compatible with this Signature. This means that args and this.types have the same length, and the type of each expression in args is assignment compatible with the corresponding types in this.types. Also, the targetType must actually contain a non-static method of the appropriate signature and name.- Throws:
java.lang.IllegalArgumentException- if args is not compatible with this.types.
-
checkStaticCompatibility
public void checkStaticCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args)
Check whether the list of expression in args is statically compatible with this Signature. This means that args and this.types have the same length, and the type of each expression in args is assignment compatible with the corresponding types in this.types. Also, the targetType must actually contain a static method of the appropriate signature and name.- Throws:
java.lang.IllegalArgumentException- if args is not compatible with this.types.
-
checkConstructorCompatibility
public void checkConstructorCompatibility(Type targetType, java.util.List<Expression> args)
Check whether the list of expression in args is statically compatible with this Signature. This means that args and this.types have the same length, and the type of each expression in args is assignment compatible with the corresponding types in this.types. Also, the targetType must actually contain a constructor of the appropriate signature and name.- Throws:
java.lang.IllegalArgumentException- if args is not compatible with this.types.
-
getMethods
private static java.util.Set<MethodInfo> getMethods(Type type, java.lang.String ident, boolean staticOnly)
-
getCompatibleMethods
private static java.util.Set<MethodInfo> getCompatibleMethods(java.util.Set<MethodInfo> methods, java.util.List<Type> argTypes)
-
sprintf
private static java.lang.String sprintf(java.lang.String format, java.lang.Object... args)
-
getCallTypeString
private static java.lang.String getCallTypeString(Signature.CallType ct, java.lang.String ident)
-
getTypeListString
private static java.lang.String getTypeListString(java.util.List<Type> types)
-
getMethodListString
private static java.lang.String getMethodListString(java.util.Set<MethodInfo> mlist)
-
returnCompatibleMethod
private static MethodInfo returnCompatibleMethod(Type type, java.lang.String ident, java.util.List<Type> argTypes, Signature.CallType ctype, java.util.Set<MethodInfo> compatibleMethods)
-
fromMethodCallUsingTypes
private static Signature fromMethodCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types, boolean isStaticCall)
-
fromMethodCall
private static Signature fromMethodCall(Type type, java.lang.String ident, java.util.List<Expression> exprs, boolean isStaticCall)
-
fromCall
public static Signature fromCall(Type type, java.lang.String ident, java.util.List<Expression> exprs)
-
fromCallUsingTypes
public static Signature fromCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types)
-
fromStaticCall
public static Signature fromStaticCall(Type type, java.lang.String ident, java.util.List<Expression> exprs)
-
fromStaticCallUsingTypes
public static Signature fromStaticCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types)
-
fromConstructorUsingTypes
public static Signature fromConstructorUsingTypes(Type type, java.util.List<Type> types)
-
fromConstructor
public static Signature fromConstructor(Type type, java.util.List<Expression> exprs)
-
-