Class AnnotationValue<A extends java.lang.annotation.Annotation>

  • Type Parameters:
    A - The annotation type
    All Implemented Interfaces:
    AnnotationValueResolver, ValueResolver<java.lang.CharSequence>

    public class AnnotationValue<A extends java.lang.annotation.Annotation>
    extends java.lang.Object
    implements AnnotationValueResolver
    A runtime representation of the an annotation and its values.

    This class implements the AnnotationValueResolver interface and methods such as ValueResolver.get(CharSequence, Class) can be used to retrieve the values of annotation members.

    If a member is not present then the methods of the class will attempt to resolve the default value for a given annotation member. In this sense the behaviour of this class is similar to how a implementation of Annotation behaves.

    Since:
    1.0
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AnnotationValue​(AnnotationValue<A> target, java.util.Map<java.lang.String,​java.lang.Object> defaultValues, ConvertibleValues<java.lang.Object> convertibleValues, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      Internal copy constructor.
        AnnotationValue​(java.lang.String annotationName)  
        AnnotationValue​(java.lang.String annotationName, ConvertibleValues<java.lang.Object> convertibleValues)  
        AnnotationValue​(java.lang.String annotationName, java.util.Map<java.lang.CharSequence,​java.lang.Object> values)  
        AnnotationValue​(java.lang.String annotationName, java.util.Map<java.lang.CharSequence,​java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy)  
        AnnotationValue​(java.lang.String annotationName, java.util.Map<java.lang.CharSequence,​java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy, java.util.List<AnnotationValue<?>> stereotypes)  
        AnnotationValue​(java.lang.String annotationName, java.util.Map<java.lang.CharSequence,​java.lang.Object> values, java.util.Map<java.lang.String,​java.lang.Object> defaultValues)  
        AnnotationValue​(java.lang.String annotationName, java.util.Map<java.lang.CharSequence,​java.lang.Object> values, java.util.Map<java.lang.String,​java.lang.Object> defaultValues, java.lang.annotation.RetentionPolicy retentionPolicy)  
        AnnotationValue​(java.lang.String annotationName, java.util.Map<java.lang.CharSequence,​java.lang.Object> values, java.util.Map<java.lang.String,​java.lang.Object> defaultValues, java.lang.annotation.RetentionPolicy retentionPolicy, java.util.List<AnnotationValue<?>> stereotypes)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<AnnotationClassValue<?>> annotationClassValue​(java.lang.String member)
      The AnnotationClassValue instance for the given member.
      AnnotationClassValue<?>[] annotationClassValues​(java.lang.String member)
      The AnnotationClassValue instances for the given member.
      java.util.Optional<java.lang.Boolean> booleanValue​(java.lang.String member)
      The boolean value of the given member.
      java.util.Optional<java.lang.Boolean> booleanValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The boolean value of the given member.
      boolean[] booleanValues​(java.lang.String member)
      The boolean[] value for the given member.
      static <T extends java.lang.annotation.Annotation>
      AnnotationValueBuilder<T>
      builder​(AnnotationValue<T> annotation, java.lang.annotation.RetentionPolicy retentionPolicy)
      Start building a new annotation existing value and retention policy.
      static <T extends java.lang.annotation.Annotation>
      AnnotationValueBuilder<T>
      builder​(java.lang.Class<T> annotation)
      Start building a new annotation for the given name.
      static <T extends java.lang.annotation.Annotation>
      AnnotationValueBuilder<T>
      builder​(java.lang.String annotationName)
      Start building a new annotation for the given name.
      static <T extends java.lang.annotation.Annotation>
      AnnotationValueBuilder<T>
      builder​(java.lang.String annotationName, java.lang.annotation.RetentionPolicy retentionPolicy)
      Start building a new annotation for the given name.
      java.util.Optional<java.lang.Byte> byteValue​(java.lang.String member)
      The byte value of the given member.
      byte[] byteValues​(java.lang.String member)
      The byte[] value for the given member.
      java.util.Optional<java.lang.Character> charValue​(java.lang.String member)
      The char value of the given member.
      char[] charValues​(java.lang.String member)
      The char[] value for the given member.
      java.util.Optional<java.lang.Class<?>> classValue()
      The value of the annotation as a Class.
      java.util.Optional<java.lang.Class<?>> classValue​(java.lang.String member)
      The value of the given annotation member as a Class.
      <T> java.util.Optional<java.lang.Class<? extends T>> classValue​(java.lang.String member, java.lang.Class<T> requiredType)
      The value of the given annotation member as a Class.
      java.util.Optional<java.lang.Class<?>> classValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The value of the given annotation member as a Class.
      java.lang.Class<?>[] classValues​(java.lang.String member)
      The value of the given annotation member as a Class.
      boolean contains​(java.lang.String member)
      Whether a particular member is present.
      java.util.OptionalDouble doubleValue()
      The double value of the given member.
      java.util.OptionalDouble doubleValue​(java.lang.String member)
      The double value of the given member.
      java.util.OptionalDouble doubleValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The double value of the given member.
      double[] doubleValues​(java.lang.String member)
      The double[] value for the given member.
      <E extends java.lang.Enum>
      java.util.Optional<E>
      enumValue​(java.lang.String member, java.lang.Class<E> enumType)
      Return the enum value of the given member of the given enum type.
      <E extends java.lang.Enum>
      java.util.Optional<E>
      enumValue​(java.lang.String member, java.lang.Class<E> enumType, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      Return the enum value of the given member of the given enum type.
      <E extends java.lang.Enum>
      E[]
      enumValues​(java.lang.String member, java.lang.Class<E> enumType)
      Return the enum values of the given member of the given enum type.
      boolean equals​(java.lang.Object obj)  
      java.util.Optional<java.lang.Float> floatValue​(java.lang.String member)
      The double value of the given member.
      java.util.Optional<java.lang.Float> floatValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The double value of the given member.
      float[] floatValues​(java.lang.String member)
      The float[] value for the given member.
      <T> java.util.Optional<T> get​(java.lang.CharSequence member, ArgumentConversionContext<T> conversionContext)
      Resolve the given property for the given name.
      <T extends java.lang.annotation.Annotation>
      java.util.Optional<AnnotationValue<T>>
      getAnnotation​(java.lang.String member)
      Gets a list of AnnotationValue for the given member.
      <T extends java.lang.annotation.Annotation>
      java.util.Optional<AnnotationValue<T>>
      getAnnotation​(java.lang.String member, java.lang.Class<T> type)
      Gets a list of AnnotationValue for the given member.
      java.lang.String getAnnotationName()
      The annotation name.
      <T extends java.lang.annotation.Annotation>
      java.util.List<AnnotationValue<T>>
      getAnnotations​(java.lang.String member)
      Gets a list of AnnotationValue for the given member.
      <T extends java.lang.annotation.Annotation>
      java.util.List<AnnotationValue<T>>
      getAnnotations​(java.lang.String member, java.lang.Class<T> type)
      Gets a list of AnnotationValue for the given member.
      ConvertibleValues<java.lang.Object> getConvertibleValues()  
      java.util.Set<java.lang.CharSequence> getMemberNames()
      Resolves the names of all the present annotation members.
      java.util.Map<java.lang.String,​java.lang.String> getProperties​(java.lang.String member)
      Resolves a map of properties for a member that is an array of annotations that have members called "name" or "key" to represent the key and "value" to represent the value.
      java.util.Map<java.lang.String,​java.lang.String> getProperties​(java.lang.String member, java.lang.String keyMember)
      Resolve properties with a custom key member.
      <T> T getRequiredValue​(java.lang.Class<T> type)
      Get the value of the value member of the annotation.
      <T> T getRequiredValue​(java.lang.String member, java.lang.Class<T> type)
      Get the value of the value member of the annotation.
      java.lang.annotation.RetentionPolicy getRetentionPolicy()  
      java.util.List<AnnotationValue<?>> getStereotypes()  
      <T> java.util.Optional<T> getValue​(ArgumentConversionContext<T> conversionContext)
      Get the value of the value member of the annotation.
      <T> java.util.Optional<T> getValue​(Argument<T> argument)
      Get the value of the value member of the annotation.
      <T> java.util.Optional<T> getValue​(java.lang.Class<T> type)
      Get the value of the value member of the annotation.
      java.util.Map<java.lang.CharSequence,​java.lang.Object> getValues()  
      int hashCode()  
      java.util.OptionalInt intValue()
      The integer value of the given member.
      java.util.OptionalInt intValue​(java.lang.String member)
      The integer value of the given member.
      java.util.OptionalInt intValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The integer value of the given member.
      int[] intValues​(java.lang.String member)
      The int[] value for the given member.
      boolean isFalse()  
      boolean isFalse​(java.lang.String member)  
      boolean isPresent​(java.lang.CharSequence member)
      Is the given member present.
      boolean isTrue()  
      boolean isTrue​(java.lang.String member)  
      boolean isTrue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)  
      java.util.OptionalLong longValue​(java.lang.String member)
      The long value of the given member.
      java.util.OptionalLong longValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The long value of the given member.
      long[] longValues​(java.lang.String member)
      The long[] value for the given member.
      static java.lang.Class<?>[] resolveClassValues​(java.lang.Object value)
      The classes class values for the given value.
      static <E extends java.lang.Enum>
      E[]
      resolveEnumValues​(java.lang.Class<E> enumType, java.lang.Object rawValue)
      The enum values for the given enum type and raw value.
      static java.lang.String[] resolveStringArray​(java.lang.String[] strs, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The string[] values for the given value.
      static java.lang.String[] resolveStringValues​(java.lang.Object value, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The string values for the given value.
      java.util.Optional<java.lang.Short> shortValue​(java.lang.String member)
      The short value of the given member.
      java.util.Optional<java.lang.Short> shortValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The short value of the given member.
      short[] shortValues​(java.lang.String member)
      The short[] value for the given member.
      java.util.Optional<java.lang.String> stringValue()
      The double value of the given member.
      java.util.Optional<java.lang.String> stringValue​(java.lang.String member)
      The string value of the given member.
      java.util.Optional<java.lang.String> stringValue​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The string value of the given member.
      java.lang.String[] stringValues​(java.lang.String member)
      The string values for the given member.
      java.lang.String[] stringValues​(java.lang.String member, java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
      The string values for the given member and mapper.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               java.util.Map<java.lang.CharSequence,​java.lang.Object> values)
        Parameters:
        annotationName - The annotation name
        values - The values
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               java.util.Map<java.lang.CharSequence,​java.lang.Object> values,
                               java.lang.annotation.RetentionPolicy retentionPolicy)
        Parameters:
        annotationName - The annotation name
        values - The values
        retentionPolicy - The retention policy
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               java.util.Map<java.lang.CharSequence,​java.lang.Object> values,
                               java.lang.annotation.RetentionPolicy retentionPolicy,
                               java.util.List<AnnotationValue<?>> stereotypes)
        Parameters:
        annotationName - The annotation name
        values - The values
        retentionPolicy - The retention policy
        stereotypes - The stereotypes of the annotation
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               java.util.Map<java.lang.CharSequence,​java.lang.Object> values,
                               java.util.Map<java.lang.String,​java.lang.Object> defaultValues)
        Parameters:
        annotationName - The annotation name
        values - The values
        defaultValues - The default values
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               java.util.Map<java.lang.CharSequence,​java.lang.Object> values,
                               java.util.Map<java.lang.String,​java.lang.Object> defaultValues,
                               java.lang.annotation.RetentionPolicy retentionPolicy)
        Parameters:
        annotationName - The annotation name
        values - The values
        defaultValues - The default values
        retentionPolicy - The retention policy
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               java.util.Map<java.lang.CharSequence,​java.lang.Object> values,
                               java.util.Map<java.lang.String,​java.lang.Object> defaultValues,
                               java.lang.annotation.RetentionPolicy retentionPolicy,
                               java.util.List<AnnotationValue<?>> stereotypes)
        Parameters:
        annotationName - The annotation name
        values - The values
        defaultValues - The default values
        retentionPolicy - The retention policy
        stereotypes - The stereotypes of the annotation
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName)
        Parameters:
        annotationName - The annotation name
      • AnnotationValue

        @Internal
        public AnnotationValue​(java.lang.String annotationName,
                               ConvertibleValues<java.lang.Object> convertibleValues)
        Parameters:
        annotationName - The annotation name
        convertibleValues - The convertible values
      • AnnotationValue

        @Internal
        protected AnnotationValue​(AnnotationValue<A> target,
                                  java.util.Map<java.lang.String,​java.lang.Object> defaultValues,
                                  ConvertibleValues<java.lang.Object> convertibleValues,
                                  java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        Internal copy constructor.
        Parameters:
        target - The target
        defaultValues - The default values
        convertibleValues - The convertible values
        valueMapper - The value mapper
    • Method Detail

      • getRetentionPolicy

        @NonNull
        public final java.lang.annotation.RetentionPolicy getRetentionPolicy()
        Returns:
        The retention policy.
      • getStereotypes

        @Nullable
        public java.util.List<AnnotationValue<?>> getStereotypes()
        Returns:
        The stereotypes of the annotation
      • getProperties

        @NonNull
        public java.util.Map<java.lang.String,​java.lang.String> getProperties​(@NonNull
                                                                                    java.lang.String member)
        Resolves a map of properties for a member that is an array of annotations that have members called "name" or "key" to represent the key and "value" to represent the value.

        For example consider the following annotation definition:

         @PropertySource({ @Property(name = "one", value = "1"), @Property(name = "two", value = "2")})
         public class MyBean {
                ...
         }

        You can use this method to resolve the values of the PropertySource annotation such that the following assertion is true:

         annotationValue.getProperties("value") == [one:1, two:2]
         
        Parameters:
        member - The member
        Returns:
        The properties as a immutable map.
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.String> getProperties​(@NonNull
                                                                                    java.lang.String member,
                                                                                    java.lang.String keyMember)
        Resolve properties with a custom key member.
        Parameters:
        member - The member to resolve the properties from
        keyMember - The member of the sub annotation that represents the key.
        Returns:
        The properties.
        See Also:
        getProperties(String)
      • enumValue

        public <E extends java.lang.Enum> java.util.Optional<E> enumValue​(@NonNull
                                                                          java.lang.String member,
                                                                          @NonNull
                                                                          java.lang.Class<E> enumType)
        Return the enum value of the given member of the given enum type.
        Specified by:
        enumValue in interface AnnotationValueResolver
        Type Parameters:
        E - The enum type
        Parameters:
        member - The annotation member
        enumType - The required type
        Returns:
        An Optional of the enum value
      • enumValue

        public <E extends java.lang.Enum> java.util.Optional<E> enumValue​(@NonNull
                                                                          java.lang.String member,
                                                                          @NonNull
                                                                          java.lang.Class<E> enumType,
                                                                          java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        Return the enum value of the given member of the given enum type.
        Type Parameters:
        E - The enum type
        Parameters:
        member - The annotation member
        enumType - The required type
        valueMapper - The value mapper
        Returns:
        An Optional of the enum value
      • enumValues

        public <E extends java.lang.Enum> E[] enumValues​(@NonNull
                                                         java.lang.String member,
                                                         @NonNull
                                                         java.lang.Class<E> enumType)
        Return the enum values of the given member of the given enum type.
        Specified by:
        enumValues in interface AnnotationValueResolver
        Type Parameters:
        E - The enum type
        Parameters:
        member - The annotation member
        enumType - The required type
        Returns:
        An array of enum values
      • classValue

        @NonNull
        public java.util.Optional<java.lang.Class<?>> classValue()
        The value of the annotation as a Class.
        Specified by:
        classValue in interface AnnotationValueResolver
        Returns:
        An Optional class
      • classValue

        public java.util.Optional<java.lang.Class<?>> classValue​(@NonNull
                                                                 java.lang.String member)
        The value of the given annotation member as a Class.
        Specified by:
        classValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An Optional class
      • classValue

        public <T> java.util.Optional<java.lang.Class<? extends T>> classValue​(@NonNull
                                                                               java.lang.String member,
                                                                               @NonNull
                                                                               java.lang.Class<T> requiredType)
        The value of the given annotation member as a Class.
        Specified by:
        classValue in interface AnnotationValueResolver
        Type Parameters:
        T - The required type
        Parameters:
        member - The annotation member
        requiredType - The required type
        Returns:
        An Optional class
      • classValue

        public java.util.Optional<java.lang.Class<?>> classValue​(@NonNull
                                                                 java.lang.String member,
                                                                 @Nullable
                                                                 java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The value of the given annotation member as a Class.
        Parameters:
        member - The annotation member
        valueMapper - The raw value mapper
        Returns:
        An Optional class
      • booleanValues

        public boolean[] booleanValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The boolean[] value for the given member.
        Specified by:
        booleanValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of boolean
      • byteValues

        public byte[] byteValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The byte[] value for the given member.
        Specified by:
        byteValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of byte
      • charValues

        public char[] charValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The char[] value for the given member.
        Specified by:
        charValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of char
      • intValues

        public int[] intValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The int[] value for the given member.
        Specified by:
        intValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of int
      • doubleValues

        public double[] doubleValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The double[] value for the given member.
        Specified by:
        doubleValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of double
      • longValues

        public long[] longValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The long[] value for the given member.
        Specified by:
        longValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of long
      • floatValues

        public float[] floatValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The float[] value for the given member.
        Specified by:
        floatValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of float
      • shortValues

        public short[] shortValues​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The short[] value for the given member.
        Specified by:
        shortValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of short
      • stringValues

        public java.lang.String[] stringValues​(@NonNull
                                               java.lang.String member,
                                               java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The string values for the given member and mapper.
        Parameters:
        member - The member
        valueMapper - The mapper
        Returns:
        The string values
      • classValues

        public java.lang.Class<?>[] classValues​(@NonNull
                                                java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The value of the given annotation member as a Class.
        Specified by:
        classValues in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An array of classes
      • intValue

        public java.util.OptionalInt intValue​(@NonNull
                                              java.lang.String member)
        The integer value of the given member.
        Specified by:
        intValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An OptionalInt
      • intValue

        public java.util.OptionalInt intValue​(@NonNull
                                              java.lang.String member,
                                              @Nullable
                                              java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The integer value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - The value mapper
        Returns:
        An OptionalInt
      • byteValue

        public java.util.Optional<java.lang.Byte> byteValue​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The byte value of the given member.
        Specified by:
        byteValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An Optional of Byte
      • charValue

        public java.util.Optional<java.lang.Character> charValue​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The char value of the given member.
        Specified by:
        charValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An Optional of Character
      • intValue

        public java.util.OptionalInt intValue()
        The integer value of the given member.
        Specified by:
        intValue in interface AnnotationValueResolver
        Returns:
        An OptionalInt
      • longValue

        public java.util.OptionalLong longValue​(@NonNull
                                                java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The long value of the given member.
        Specified by:
        longValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An OptionalLong
      • longValue

        public java.util.OptionalLong longValue​(@NonNull
                                                java.lang.String member,
                                                @Nullable
                                                java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The long value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - The value mapper
        Returns:
        An OptionalLong
      • shortValue

        public java.util.Optional<java.lang.Short> shortValue​(@NonNull
                                                              java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The short value of the given member.
        Specified by:
        shortValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An Optional of Short
      • shortValue

        public java.util.Optional<java.lang.Short> shortValue​(@NonNull
                                                              java.lang.String member,
                                                              @Nullable
                                                              java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The short value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - The value mapper
        Returns:
        An Optional of Short
      • booleanValue

        public java.util.Optional<java.lang.Boolean> booleanValue​(@NonNull
                                                                  java.lang.String member,
                                                                  @Nullable
                                                                  java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The boolean value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - The value mapper
        Returns:
        An Optional boolean
      • doubleValue

        public java.util.OptionalDouble doubleValue​(@NonNull
                                                    java.lang.String member)
        The double value of the given member.
        Specified by:
        doubleValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An OptionalDouble
      • doubleValue

        public java.util.OptionalDouble doubleValue​(@NonNull
                                                    java.lang.String member,
                                                    @Nullable
                                                    java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The double value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - The value mapper
        Returns:
        An OptionalDouble
      • floatValue

        public java.util.Optional<java.lang.Float> floatValue​(java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The double value of the given member.
        Specified by:
        floatValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An OptionalDouble
      • floatValue

        public java.util.Optional<java.lang.Float> floatValue​(@NonNull
                                                              java.lang.String member,
                                                              @Nullable
                                                              java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The double value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - The value mapper
        Returns:
        An OptionalDouble
      • doubleValue

        public java.util.OptionalDouble doubleValue()
        The double value of the given member.
        Specified by:
        doubleValue in interface AnnotationValueResolver
        Returns:
        An OptionalDouble
      • stringValue

        public java.util.Optional<java.lang.String> stringValue​(@NonNull
                                                                java.lang.String member)
        The string value of the given member.
        Specified by:
        stringValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An OptionalInt
      • stringValue

        public java.util.Optional<java.lang.String> stringValue​(@NonNull
                                                                java.lang.String member,
                                                                @Nullable
                                                                java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The string value of the given member.
        Parameters:
        member - The annotation member
        valueMapper - An optional raw value mapper
        Returns:
        An OptionalInt
      • stringValue

        public java.util.Optional<java.lang.String> stringValue()
        The double value of the given member.
        Specified by:
        stringValue in interface AnnotationValueResolver
        Returns:
        An OptionalInt
      • booleanValue

        public java.util.Optional<java.lang.Boolean> booleanValue​(@NonNull
                                                                  java.lang.String member)
        Description copied from interface: AnnotationValueResolver
        The boolean value of the given member.
        Specified by:
        booleanValue in interface AnnotationValueResolver
        Parameters:
        member - The annotation member
        Returns:
        An Optional boolean
      • isPresent

        public final boolean isPresent​(java.lang.CharSequence member)
        Is the given member present.
        Specified by:
        isPresent in interface AnnotationValueResolver
        Parameters:
        member - The member
        Returns:
        True if it is
      • isTrue

        public boolean isTrue​(java.lang.String member)
        Specified by:
        isTrue in interface AnnotationValueResolver
        Parameters:
        member - The member
        Returns:
        Is the value of the annotation true.
      • isTrue

        public boolean isTrue​(@NonNull
                              java.lang.String member,
                              @Nullable
                              java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        Parameters:
        member - The member
        valueMapper - The value mapper
        Returns:
        Is the value of the annotation true.
      • isFalse

        public boolean isFalse​(java.lang.String member)
        Specified by:
        isFalse in interface AnnotationValueResolver
        Parameters:
        member - The member
        Returns:
        Is the value of the annotation true.
      • getAnnotationName

        @NonNull
        public final java.lang.String getAnnotationName()
        The annotation name.
        Returns:
        The annotation name
      • contains

        public final boolean contains​(java.lang.String member)
        Whether a particular member is present.
        Parameters:
        member - The member
        Returns:
        True if it is
      • getMemberNames

        @NonNull
        public final java.util.Set<java.lang.CharSequence> getMemberNames()
        Resolves the names of all the present annotation members.
        Returns:
        The names of the members
      • getConvertibleValues

        @NonNull
        public ConvertibleValues<java.lang.Object> getConvertibleValues()
        Returns:
        The convertible values
      • get

        public <T> java.util.Optional<T> get​(java.lang.CharSequence member,
                                             ArgumentConversionContext<T> conversionContext)
        Description copied from interface: ValueResolver
        Resolve the given property for the given name.
        Specified by:
        get in interface ValueResolver<A extends java.lang.annotation.Annotation>
        Type Parameters:
        T - The concrete type
        Parameters:
        member - The name
        conversionContext - The conversion context
        Returns:
        An optional containing the property value if it exists and is able to be converted
      • getValue

        public <T> java.util.Optional<T> getValue​(ArgumentConversionContext<T> conversionContext)
        Get the value of the value member of the annotation.
        Type Parameters:
        T - The type
        Parameters:
        conversionContext - The conversion context
        Returns:
        The result
      • getValue

        public final <T> java.util.Optional<T> getValue​(Argument<T> argument)
        Get the value of the value member of the annotation.
        Type Parameters:
        T - The type
        Parameters:
        argument - The argument
        Returns:
        The result
      • getValue

        public final <T> java.util.Optional<T> getValue​(java.lang.Class<T> type)
        Get the value of the value member of the annotation.
        Type Parameters:
        T - The type
        Parameters:
        type - The type
        Returns:
        The result
      • getRequiredValue

        @NonNull
        public final <T> T getRequiredValue​(java.lang.Class<T> type)
        Get the value of the value member of the annotation.
        Type Parameters:
        T - The type
        Parameters:
        type - The type
        Returns:
        The result
        Throws:
        java.lang.IllegalStateException - If no member is available that conforms to the given type
      • getRequiredValue

        @NonNull
        public final <T> T getRequiredValue​(java.lang.String member,
                                            java.lang.Class<T> type)
        Get the value of the value member of the annotation.
        Type Parameters:
        T - The type
        Parameters:
        member - The member
        type - The type
        Returns:
        The result
        Throws:
        java.lang.IllegalStateException - If no member is available that conforms to the given name and type
      • getAnnotations

        @NonNull
        public <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getAnnotations​(java.lang.String member,
                                                                                                             java.lang.Class<T> type)
        Gets a list of AnnotationValue for the given member.
        Type Parameters:
        T - The type
        Parameters:
        member - The member
        type - The type
        Returns:
        The result
        Throws:
        java.lang.IllegalStateException - If no member is available that conforms to the given name and type
      • getAnnotations

        @NonNull
        public <T extends java.lang.annotation.Annotation> java.util.List<AnnotationValue<T>> getAnnotations​(java.lang.String member)
        Gets a list of AnnotationValue for the given member.
        Type Parameters:
        T - The type
        Parameters:
        member - The member
        Returns:
        The result
        Throws:
        java.lang.IllegalStateException - If no member is available that conforms to the given name and type
      • getAnnotation

        @NonNull
        public <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> getAnnotation​(java.lang.String member,
                                                                                                                java.lang.Class<T> type)
        Gets a list of AnnotationValue for the given member.
        Type Parameters:
        T - The type
        Parameters:
        member - The member
        type - The type
        Returns:
        The result
        Throws:
        java.lang.IllegalStateException - If no member is available that conforms to the given name and type
      • getAnnotation

        @NonNull
        public <T extends java.lang.annotation.Annotation> java.util.Optional<AnnotationValue<T>> getAnnotation​(@NonNull
                                                                                                                java.lang.String member)
        Gets a list of AnnotationValue for the given member.
        Type Parameters:
        T - The type
        Parameters:
        member - The member
        Returns:
        The result
        Throws:
        java.lang.IllegalStateException - If no member is available that conforms to the given name and type
        Since:
        3.3.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • builder

        public static <T extends java.lang.annotation.Annotation> AnnotationValueBuilder<T> builder​(java.lang.String annotationName)
        Start building a new annotation for the given name.
        Type Parameters:
        T - The annotation type
        Parameters:
        annotationName - The annotation name
        Returns:
        The builder
      • builder

        public static <T extends java.lang.annotation.Annotation> AnnotationValueBuilder<T> builder​(java.lang.String annotationName,
                                                                                                    java.lang.annotation.RetentionPolicy retentionPolicy)
        Start building a new annotation for the given name.
        Type Parameters:
        T - The annotation type
        Parameters:
        annotationName - The annotation name
        retentionPolicy - The retention policy
        Returns:
        The builder
        Since:
        2.4.0
      • builder

        public static <T extends java.lang.annotation.Annotation> AnnotationValueBuilder<T> builder​(java.lang.Class<T> annotation)
        Start building a new annotation for the given name.
        Type Parameters:
        T - The annotation type
        Parameters:
        annotation - The annotation name
        Returns:
        The builder
      • builder

        public static <T extends java.lang.annotation.Annotation> AnnotationValueBuilder<T> builder​(@NonNull
                                                                                                    AnnotationValue<T> annotation,
                                                                                                    @Nullable
                                                                                                    java.lang.annotation.RetentionPolicy retentionPolicy)
        Start building a new annotation existing value and retention policy.
        Type Parameters:
        T - The annotation type
        Parameters:
        annotation - The annotation name
        retentionPolicy - The retention policy. Defaults to runtime.
        Returns:
        The builder
      • resolveStringValues

        @Internal
        @Nullable
        public static java.lang.String[] resolveStringValues​(@Nullable
                                                             java.lang.Object value,
                                                             @Nullable
                                                             java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The string values for the given value.
        Parameters:
        value - The value
        valueMapper - The value mapper
        Returns:
        The string[] or null
      • resolveEnumValues

        @Internal
        @NonNull
        public static <E extends java.lang.Enum> E[] resolveEnumValues​(@NonNull
                                                                       java.lang.Class<E> enumType,
                                                                       @Nullable
                                                                       java.lang.Object rawValue)
        The enum values for the given enum type and raw value.
        Type Parameters:
        E - The enum generic type
        Parameters:
        enumType - The enum type
        rawValue - The raw value
        Returns:
        An array of enum values
      • resolveStringArray

        @Internal
        public static java.lang.String[] resolveStringArray​(java.lang.String[] strs,
                                                            @Nullable
                                                            java.util.function.Function<java.lang.Object,​java.lang.Object> valueMapper)
        The string[] values for the given value.
        Parameters:
        strs - The strings
        valueMapper - The value mapper
        Returns:
        The string[] or the original string
      • resolveClassValues

        @Internal
        @Nullable
        public static java.lang.Class<?>[] resolveClassValues​(@Nullable
                                                              java.lang.Object value)
        The classes class values for the given value.
        Parameters:
        value - The value
        Returns:
        The class values or null