Class Signature

java.lang.Object
org.glassfish.pfl.dynamic.codegen.spi.Signature

@Immutable public final class Signature extends Object
Represents the signature of a method, which is sometimes needed for selecting the correct method.
  • Field Details

    • rtype

      private Type rtype
    • types

      private List<Type> types
    • signature

      private String signature
  • Constructor Details

    • Signature

      private Signature(Type rtype, List<Type> types)
  • Method Details

    • make

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

      public Type returnType()
    • argTypes

      public List<Type> argTypes()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • signature

      public String signature()
    • displayAsMethod

      public String displayAsMethod()
    • displayAsMethod

      public String displayAsMethod(String methodName)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • checkArgTypeCompatibility

      private void checkArgTypeCompatibility(List<Type> atypes)
    • checkArgTypeCompatibility

      private boolean checkArgTypeCompatibility(List<Type> atypes, boolean throwsException)
    • getExprTypes

      static List<Type> getExprTypes(List<Expression> exprs)
    • getClassInfo

      private static ClassInfo getClassInfo(Type type)
    • checkCompatibility

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

      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.
      Throws:
      IllegalArgumentException - if args is not compatible with this.types.
    • checkStaticCompatibility

      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.
      Throws:
      IllegalArgumentException - if args is not compatible with this.types.
    • checkConstructorCompatibility

      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.
      Throws:
      IllegalArgumentException - if args is not compatible with this.types.
    • getMethods

      private static Set<MethodInfo> getMethods(Type type, String ident, boolean staticOnly)
    • getCompatibleMethods

      private static Set<MethodInfo> getCompatibleMethods(Set<MethodInfo> methods, List<Type> argTypes)
    • sprintf

      private static String sprintf(String format, Object... args)
    • getCallTypeString

      private static String getCallTypeString(Signature.CallType ct, String ident)
    • getTypeListString

      private static String getTypeListString(List<Type> types)
    • getMethodListString

      private static String getMethodListString(Set<MethodInfo> mlist)
    • returnCompatibleMethod

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

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

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

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

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

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

      public static Signature fromStaticCallUsingTypes(Type type, String ident, List<Type> types)
    • fromConstructorUsingTypes

      public static Signature fromConstructorUsingTypes(Type type, List<Type> types)
    • fromConstructor

      public static Signature fromConstructor(Type type, List<Expression> exprs)