Class AnnotationValue.ForConstant<U>

java.lang.Object
net.bytebuddy.description.annotation.AnnotationValue.AbstractBase<U,U>
net.bytebuddy.description.annotation.AnnotationValue.ForConstant<U>
Type Parameters:
U - The type where primitive values are represented by their boxed type.
All Implemented Interfaces:
AnnotationValue<U,U>
Enclosing interface:
AnnotationValue<T,S>

public static class AnnotationValue.ForConstant<U> extends AnnotationValue.AbstractBase<U,U>
Represents a primitive value, a String or an array of the latter types.
  • Field Details

  • Constructor Details

    • ForConstant

      protected ForConstant(U value, AnnotationValue.ForConstant.PropertyDelegate propertyDelegate)
      Creates a new constant annotation value.
      Parameters:
      value - The represented value.
      propertyDelegate - The property delegate for the value's type.
  • Method Details

    • of

      public static AnnotationValue<Boolean,Boolean> of(boolean value)
      Creates an annotation value for a boolean value.
      Parameters:
      value - The boolean value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Byte,Byte> of(byte value)
      Creates an annotation value for a byte value.
      Parameters:
      value - The byte value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Short,Short> of(short value)
      Creates an annotation value for a short value.
      Parameters:
      value - The short value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Character,Character> of(char value)
      Creates an annotation value for a char value.
      Parameters:
      value - The char value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Integer,Integer> of(int value)
      Creates an annotation value for a int value.
      Parameters:
      value - The int value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Long,Long> of(long value)
      Creates an annotation value for a long value.
      Parameters:
      value - The long value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Float,Float> of(float value)
      Creates an annotation value for a float value.
      Parameters:
      value - The float value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<Double,Double> of(double value)
      Creates an annotation value for a double value.
      Parameters:
      value - The double value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<String,String> of(String value)
      Creates an annotation value for a String value.
      Parameters:
      value - The String value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<boolean[],boolean[]> of(boolean... value)
      Creates an annotation value for a boolean[] value.
      Parameters:
      value - The boolean[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<byte[],byte[]> of(byte... value)
      Creates an annotation value for a byte[] value.
      Parameters:
      value - The byte[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<short[],short[]> of(short... value)
      Creates an annotation value for a short[] value.
      Parameters:
      value - The short[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<char[],char[]> of(char... value)
      Creates an annotation value for a char[] value.
      Parameters:
      value - The char[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<int[],int[]> of(int... value)
      Creates an annotation value for a int[] value.
      Parameters:
      value - The int[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<long[],long[]> of(long... value)
      Creates an annotation value for a long[] value.
      Parameters:
      value - The long[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<float[],float[]> of(float... value)
      Creates an annotation value for a float[] value.
      Parameters:
      value - The float[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<double[],double[]> of(double... value)
      Creates an annotation value for a double[] value.
      Parameters:
      value - The double[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<String[],String[]> of(String... value)
      Creates an annotation value for a String[] value.
      Parameters:
      value - The String[] value to represent.
      Returns:
      An appropriate annotation value.
    • of

      public static AnnotationValue<?,?> of(Object value)
      Creates an annotation value for any constant value, i.e any primitive (wrapper) type, any primitive array type or any String value or array. If no constant annotation type is provided, a runtime exception is thrown.
      Parameters:
      value - The value to represent.
      Returns:
      An appropriate annotation value.
    • getState

      public AnnotationValue.State getState()
      Returns the state of the represented annotation value.
      Returns:
      The state represented by this instance.
    • getSort

      public AnnotationValue.Sort getSort()
      Returns the property type of the annotation value.
      Returns:
      The property type of the annotation value.
    • filter

      public AnnotationValue<U,U> filter(MethodDescription.InDefinedShape property, TypeDefinition typeDefinition)
      Filters this annotation value as a valid value of the provided property.
      Parameters:
      property - The property to filter against.
      typeDefinition - The expected type.
      Returns:
      This annotation value or a new annotation value that describes why this value is not a valid value for the supplied property.
    • resolve

      public U resolve()
      Resolves the unloaded value of this annotation. The return value of this method is not defined if this annotation value is invalid.
      Returns:
      The unloaded value of this annotation.
    • load

      public AnnotationValue.Loaded<U> load(@MaybeNull ClassLoader classLoader)
      Returns the loaded value of this annotation.
      Parameters:
      classLoader - The class loader for loading this value or null for using the boot loader.
      Returns:
      The loaded value of this annotation.
    • hashCode

      @Enhance("hashCode") public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@MaybeNull Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object