Class GemValue<T>

  • Type Parameters:
    T - the type represented by this annotation value

    public class GemValue<T>
    extends java.lang.Object
    Class representing a annotation value
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GemValue​(T value, T defaultValue, javax.lang.model.element.AnnotationValue annotationValue)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <V> GemValue<V> create​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValue annotationDefaultValue, java.lang.Class<V> valueClass)  
      static <V> GemValue<V> create​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValue annotationDefaultValue, java.util.function.Function<javax.lang.model.element.AnnotationMirror,​V> creator)  
      static <V> GemValue<java.util.List<V>> createArray​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValue annotationDefaultValue, java.lang.Class<V> valueClass)  
      static <V> GemValue<java.util.List<V>> createArray​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValue annotationDefaultValue, java.util.function.Function<javax.lang.model.element.AnnotationMirror,​V> creator)  
      static GemValue<java.lang.String> createEnum​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValue annotationDefaultValue)  
      static GemValue<java.util.List<java.lang.String>> createEnumArray​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValue annotationDefaultValue)  
      T get()
      The implied valued, the value set by the user, default value when not defined
      javax.lang.model.element.AnnotationValue getAnnotationValue()
      The annotation value, e.g.
      T getDefaultValue()
      The default value, as declared in the annotation
      T getValue()
      The value set by the user
      boolean hasValue()  
      boolean isValid()
      An annotation set to be valid when set by user or a default value is present.
      private static <V,​R>
      R
      visit​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValueVisitor<R,​java.lang.Class<V>> visitor, java.lang.Class<V> vClass)  
      private static <V,​R>
      java.util.List<R>
      visitList​(javax.lang.model.element.AnnotationValue annotationValue, javax.lang.model.element.AnnotationValueVisitor<java.util.List<R>,​java.lang.Class<V>> visitor, java.lang.Class<V> vClass)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • value

        private final T value
      • defaultValue

        private final T defaultValue
      • annotationValue

        private final javax.lang.model.element.AnnotationValue annotationValue
    • Constructor Detail

      • GemValue

        private GemValue​(T value,
                         T defaultValue,
                         javax.lang.model.element.AnnotationValue annotationValue)
    • Method Detail

      • create

        public static <V> GemValue<V> create​(javax.lang.model.element.AnnotationValue annotationValue,
                                             javax.lang.model.element.AnnotationValue annotationDefaultValue,
                                             java.lang.Class<V> valueClass)
      • createArray

        public static <V> GemValue<java.util.List<V>> createArray​(javax.lang.model.element.AnnotationValue annotationValue,
                                                                  javax.lang.model.element.AnnotationValue annotationDefaultValue,
                                                                  java.lang.Class<V> valueClass)
      • createEnum

        public static GemValue<java.lang.String> createEnum​(javax.lang.model.element.AnnotationValue annotationValue,
                                                            javax.lang.model.element.AnnotationValue annotationDefaultValue)
      • createEnumArray

        public static GemValue<java.util.List<java.lang.String>> createEnumArray​(javax.lang.model.element.AnnotationValue annotationValue,
                                                                                 javax.lang.model.element.AnnotationValue annotationDefaultValue)
      • create

        public static <V> GemValue<V> create​(javax.lang.model.element.AnnotationValue annotationValue,
                                             javax.lang.model.element.AnnotationValue annotationDefaultValue,
                                             java.util.function.Function<javax.lang.model.element.AnnotationMirror,​V> creator)
      • createArray

        public static <V> GemValue<java.util.List<V>> createArray​(javax.lang.model.element.AnnotationValue annotationValue,
                                                                  javax.lang.model.element.AnnotationValue annotationDefaultValue,
                                                                  java.util.function.Function<javax.lang.model.element.AnnotationMirror,​V> creator)
      • visit

        private static <V,​R> R visit​(javax.lang.model.element.AnnotationValue annotationValue,
                                           javax.lang.model.element.AnnotationValueVisitor<R,​java.lang.Class<V>> visitor,
                                           java.lang.Class<V> vClass)
      • visitList

        private static <V,​R> java.util.List<R> visitList​(javax.lang.model.element.AnnotationValue annotationValue,
                                                               javax.lang.model.element.AnnotationValueVisitor<java.util.List<R>,​java.lang.Class<V>> visitor,
                                                               java.lang.Class<V> vClass)
      • get

        public T get()
        The implied valued, the value set by the user, default value when not defined
        Returns:
        the implied value
      • getValue

        public T getValue()
        The value set by the user
        Returns:
        the value, null when not set
      • getDefaultValue

        public T getDefaultValue()
        The default value, as declared in the annotation
        Returns:
        the default value
      • getAnnotationValue

        public javax.lang.model.element.AnnotationValue getAnnotationValue()
        The annotation value, e.g. for printing messages Messager.printMessage(javax.tools.Diagnostic.Kind, java.lang.CharSequence)
        Returns:
        the annotation value (null when not set)
      • hasValue

        public boolean hasValue()
        Returns:
        true a value is set by user
      • isValid

        public boolean isValid()
        An annotation set to be valid when set by user or a default value is present.
        Returns:
        true when valid