Top Description Inners Fields Constructors Methods
org.glassfish.pfl.dynamic.codegen.spi

public final Class Signature

extends Object
Class Inheritance
Annotations
@Immutable
Imports
java.io.PrintWriter, .StringWriter, java.lang.reflect.Modifier, java.util.ArrayList, .HashSet, .Iterator, .List, .Set, org.glassfish.pfl.dynamic.codegen.impl.ExpressionInternal, org.glassfish.pfl.dynamic.copyobject.spi.Immutable

Represents the signature of a method, which is sometimes needed for selecting the correct method.
Author
Ken Cavanaugh

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private Type
private String
private List<Type>

Constructor Summary

AccessConstructor and Description
private
Signature(Type rtype, List<Type> types)

Method Summary

Modifier and TypeMethod and Description
public List<Type>
private void
private boolean
checkArgTypeCompatibility(List<Type> atypes, boolean throwsException)

private void
checkCompatibility(Type targetType, String ident, List<Expression> args, boolean isStaticMethod)

public void
checkCompatibility(Type targetType, String ident, List<Expression> args)

Check whether the list of expression in args is statically compatible with this Signature.

public void
checkConstructorCompatibility(Type targetType, List<Expression> args)

Check whether the list of expression in args is statically compatible with this Signature.

public void
checkStaticCompatibility(Type targetType, String ident, List<Expression> args)

Check whether the list of expression in args is statically compatible with this Signature.

public String
public String
displayAsMethod(String methodName)

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static Signature
fromCall(Type type, String ident, List<Expression> exprs)

public static Signature
fromCallUsingTypes(Type type, String ident, List<Type> types)

public static Signature
public static Signature
private static Signature
fromMethodCall(Type type, String ident, List<Expression> exprs, boolean isStaticCall)

private static Signature
fromMethodCallUsingTypes(Type type, String ident, List<Type> types, boolean isStaticCall)

public static Signature
fromStaticCall(Type type, String ident, List<Expression> exprs)

public static Signature
private static String
private static ClassInfo
private static Set<MethodInfo>
pack-priv static List<Type>
private static String
private static Set<MethodInfo>
getMethods(Type type, String ident, boolean staticOnly)

private static String
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public static Signature
make(Type rtype, List<Type> types)

private static MethodInfo
returnCompatibleMethod(Type type, String ident, List<Type> argTypes, Signature.CallType ctype, Set<MethodInfo> compatibleMethods)

public Type
public String
private static String
sprintf(String format, Object... args)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

rtypeback to summary
private Type rtype
signatureback to summary
private String signature
typesback to summary
private List<Type> types

Constructor Detail

Signatureback to summary
private Signature(Type rtype, List<Type> types)

Method Detail

argTypesback to summary
public List<Type> argTypes()
checkArgTypeCompatibilityback to summary
private void checkArgTypeCompatibility(List<Type> atypes)
checkArgTypeCompatibilityback to summary
private boolean checkArgTypeCompatibility(List<Type> atypes, boolean throwsException)
checkCompatibilityback to summary
private void checkCompatibility(Type targetType, String ident, List<Expression> args, boolean isStaticMethod)
checkCompatibilityback to summary
public void checkCompatibility(Type targetType, String ident, 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.

Exceptions
IllegalArgumentException:
if args is not compatible with this.types.
checkConstructorCompatibilityback to summary
public void checkConstructorCompatibility(Type targetType, 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.

Exceptions
IllegalArgumentException:
if args is not compatible with this.types.
checkStaticCompatibilityback to summary
public void checkStaticCompatibility(Type targetType, String ident, 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.

Exceptions
IllegalArgumentException:
if args is not compatible with this.types.
displayAsMethodback to summary
public String displayAsMethod()
displayAsMethodback to summary
public String displayAsMethod(String methodName)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

fromCallback to summary
public static Signature fromCall(Type type, String ident, List<Expression> exprs)
fromCallUsingTypesback to summary
public static Signature fromCallUsingTypes(Type type, String ident, List<Type> types)
fromConstructorback to summary
public static Signature fromConstructor(Type type, List<Expression> exprs)
fromConstructorUsingTypesback to summary
public static Signature fromConstructorUsingTypes(Type type, List<Type> types)
fromMethodCallback to summary
private static Signature fromMethodCall(Type type, String ident, List<Expression> exprs, boolean isStaticCall)
fromMethodCallUsingTypesback to summary
private static Signature fromMethodCallUsingTypes(Type type, String ident, List<Type> types, boolean isStaticCall)
fromStaticCallback to summary
public static Signature fromStaticCall(Type type, String ident, List<Expression> exprs)
fromStaticCallUsingTypesback to summary
public static Signature fromStaticCallUsingTypes(Type type, String ident, List<Type> types)
getCallTypeStringback to summary
private static String getCallTypeString(Signature.CallType ct, String ident)
getClassInfoback to summary
private static ClassInfo getClassInfo(Type type)
getCompatibleMethodsback to summary
private static Set<MethodInfo> getCompatibleMethods(Set<MethodInfo> methods, List<Type> argTypes)
getExprTypesback to summary
pack-priv static List<Type> getExprTypes(List<Expression> exprs)
getMethodListStringback to summary
private static String getMethodListString(Set<MethodInfo> mlist)
getMethodsback to summary
private static Set<MethodInfo> getMethods(Type type, String ident, boolean staticOnly)
getTypeListStringback to summary
private static String getTypeListString(List<Type> types)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
makeback to summary
public static Signature make(Type rtype, List<Type> types)
returnCompatibleMethodback to summary
private static MethodInfo returnCompatibleMethod(Type type, String ident, List<Type> argTypes, Signature.CallType ctype, Set<MethodInfo> compatibleMethods)
returnTypeback to summary
public Type returnType()
signatureback to summary
public String signature()
sprintfback to summary
private static String sprintf(String format, Object... args)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

org.glassfish.pfl.dynamic.codegen.spi back to summary

private final Enum Signature.CallType

extends Enum<Signature.CallType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Signature.CallType
public static final Signature.CallType
public static final Signature.CallType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Signature.CallType
public static Signature.CallType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CONSTRUCTORback to summary
public static final Signature.CallType CONSTRUCTOR
NON_STATICback to summary
public static final Signature.CallType NON_STATIC
STATICback to summary
public static final Signature.CallType STATIC

Constructor Detail

CallTypeback to summary
private CallType()

Method Detail

valueOfback to summary
public static Signature.CallType valueOf(String name)
valuesback to summary
public static Signature.CallType[] values()