Package org.mapstruct.tools.gem
Class GemValue<T>
- java.lang.Object
-
- org.mapstruct.tools.gem.GemValue<T>
-
- Type Parameters:
T- the type represented by this annotation value
public class GemValue<T> extends java.lang.ObjectClass representing a annotation value
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classGemValue.ValueAnnotationValueListVisitor<V,R>private static classGemValue.ValueAnnotationValueVisitor<V,R>
-
Field Summary
Fields Modifier and Type Field Description private javax.lang.model.element.AnnotationValueannotationValueprivate TdefaultValueprivate Tvalue
-
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)Tget()The implied valued, the value set by the user, default value when not definedjavax.lang.model.element.AnnotationValuegetAnnotationValue()The annotation value, e.g.TgetDefaultValue()The default value, as declared in the annotationTgetValue()The value set by the userbooleanhasValue()booleanisValid()An annotation set to be valid when set by user or a default value is present.private static <V,R>
Rvisit(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)
-
-
-
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 messagesMessager.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
-
-