Package bridge

Class Invocation

java.lang.Object
bridge.Invocation

public final class Invocation extends Object
A class that can be used to access field & method bridges (and other things too)
Notes:
Invocations must be constructed and completed in a single statement. Partial invocations may not be stored. Usages of these constructors are counted as invocations. Usages of LANGUAGE_LEVEL may generate forks.
  • Field Details

    • LANGUAGE_LEVEL

      public static final int LANGUAGE_LEVEL
      Creates fork(s) of your class with code tailored to the specified Java language level(s)
      Notes:
      This constant may only appear in integer comparisons as the first operand. Using it anywhere else will not compile correctly.
  • Constructor Details

    • Invocation

      public Invocation(Class<?> type)
      Starts a direct reference to something static
      Parameters:
      type - Type constant – no dynamic values are permitted here.
    • Invocation

      public Invocation(String type)
      Starts a direct reference to something static
      Parameters:
      type - Type name constant – no dynamic values or string manipulation is permitted here.
      Throws:
      NoClassDefFoundError - When no type with the provided name can be resolved.
    • Invocation

      public Invocation(@Polymorphic Object instance)
      Starts a direct reference to something that belongs to an instance of an object
      Parameters:
      instance - Object instance
      Notes:
      Calling this overload will cause the object type to be determined automatically.
    • Invocation

      public Invocation(Class<?> type, Object instance)
      Starts a direct reference to something that belongs to an instance of an object
      Parameters:
      type - Type constant – no dynamic values are permitted here.
      instance - Object instance
      Throws:
      ClassCastException - When the instance is not convertible to the provided type.
    • Invocation

      public Invocation(String type, Object instance)
      Starts a direct reference to something that belongs to an instance of an object
      Parameters:
      type - Type name constant – no dynamic values or string manipulation is permitted here.
      instance - Object instance
      Throws:
      NoClassDefFoundError - When no type with the provided name can be resolved.
      ClassCastException - When the instance is not convertible to the provided type.
  • Method Details

    • ofClassLiteral

      public Class<?> ofClassLiteral()
      Creates a direct reference to a class
      Returns:
      The real class reference.
      Throws:
      NullPointerException - When resolving the class of an instance and the instance is null.
    • ofInstanceOf

      public boolean ofInstanceOf(Class<?> type)
      Creates a direct type-compatibility check
      Parameters:
      type - Type constant – no dynamic values are permitted here.
      Returns:
      The real boolean response.
    • ofInstanceOf

      public boolean ofInstanceOf(String type)
      Creates a direct type-compatibility check
      Parameters:
      type - Type name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      The real boolean response.
      Throws:
      NoClassDefFoundError - When no type with the provided name can be resolved.
    • ofConstructor

      public Invocation.Executor ofConstructor()
      Creates a direct reference to a constructor
      Returns:
      An imaginary reference for you to execute your request with.
      Notes:
      This operation requires static context.
    • ofMethod

      public Invocation.Executor ofMethod(String name)
      Creates a direct reference to a method
      Parameters:
      name - Method name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      An imaginary reference for you to execute your request with.
      Notes:
      Calling this overload will cause the method return type to be determined automatically.
    • ofMethod

      public Invocation.Executor ofMethod(Class<?> type, String name)
      Creates a direct reference to a method
      Parameters:
      type - Method return type constant – no dynamic values are permitted here.
      name - Method name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      An imaginary reference for you to execute your request with.
    • ofMethod

      public Invocation.Executor ofMethod(String type, String name)
      Creates a direct reference to a method
      Parameters:
      type - Method return type name constant – no dynamic values or string manipulation is permitted here.
      name - Method name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      An imaginary reference for you to execute your request with.
      Throws:
      NoClassDefFoundError - When no type with the provided name can be resolved.
    • ofField

      public Invocation.Accessor ofField(String name)
      Creates a direct reference to a field
      Parameters:
      name - Field name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      An imaginary reference for you to execute your request with.
      Notes:
      Calling this overload will cause the field type to be determined automatically.
    • ofField

      public Invocation.Accessor ofField(Class<?> type, String name)
      Creates a direct reference to a field
      Parameters:
      type - Field type constant – no dynamic values are permitted here.
      name - Field name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      An imaginary reference for you to execute your request with.
    • ofField

      public Invocation.Accessor ofField(String type, String name)
      Creates a direct reference to a field
      Parameters:
      type - Field type name constant – no dynamic values or string manipulation is permitted here.
      name - Field name constant – no dynamic values or string manipulation is permitted here.
      Returns:
      An imaginary reference for you to execute your request with.
      Throws:
      NoClassDefFoundError - When no type with the provided name can be resolved.