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 class
Signature.CallType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Type>
argTypes()
private void
checkArgTypeCompatibility(java.util.List<Type> atypes)
private boolean
checkArgTypeCompatibility(java.util.List<Type> atypes, boolean throwsException)
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.private void
checkCompatibility(Type targetType, java.lang.String ident, java.util.List<Expression> args, boolean isStaticMethod)
void
checkConstructorCompatibility(Type targetType, java.util.List<Expression> args)
Check whether the list of expression in args is statically compatible with this Signature.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.java.lang.String
displayAsMethod()
java.lang.String
displayAsMethod(java.lang.String methodName)
boolean
equals(java.lang.Object obj)
static Signature
fromCall(Type type, java.lang.String ident, java.util.List<Expression> exprs)
static Signature
fromCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types)
static Signature
fromConstructor(Type type, java.util.List<Expression> exprs)
static Signature
fromConstructorUsingTypes(Type type, java.util.List<Type> types)
private static Signature
fromMethodCall(Type type, java.lang.String ident, java.util.List<Expression> exprs, boolean isStaticCall)
private static Signature
fromMethodCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types, boolean isStaticCall)
static Signature
fromStaticCall(Type type, java.lang.String ident, java.util.List<Expression> exprs)
static Signature
fromStaticCallUsingTypes(Type type, java.lang.String ident, java.util.List<Type> types)
private static java.lang.String
getCallTypeString(Signature.CallType ct, java.lang.String ident)
private static ClassInfo
getClassInfo(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.String
getMethodListString(java.util.Set<MethodInfo> mlist)
private static java.util.Set<MethodInfo>
getMethods(Type type, java.lang.String ident, boolean staticOnly)
private static java.lang.String
getTypeListString(java.util.List<Type> types)
int
hashCode()
static Signature
make(Type rtype, java.util.List<Type> types)
private static MethodInfo
returnCompatibleMethod(Type type, java.lang.String ident, java.util.List<Type> argTypes, Signature.CallType ctype, java.util.Set<MethodInfo> compatibleMethods)
Type
returnType()
java.lang.String
signature()
private static java.lang.String
sprintf(java.lang.String format, java.lang.Object... args)
java.lang.String
toString()
-
-
-
Method Detail
-
returnType
public Type returnType()
-
argTypes
public java.util.List<Type> argTypes()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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:
equals
in 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)
-
-