Class AnnotationApplier<A extends Annotation,B>
- Type Parameters:
A
- The annotation that this applier reads from.B
- The builder class to apply the annotation to.
- Direct Known Subclasses:
AnnotationApplier.NoOp
,BeanAnnotation.Applier
,BeancAnnotation.Applier
,BeanConfigAnnotation.Applier
,BeanIgnoreAnnotation.Applier
,BeanpAnnotation.Applier
,ContentAnnotation.Applier
,CsvAnnotation.Apply
,CsvConfigAnnotation.ParserApply
,CsvConfigAnnotation.SerializerApply
,ExampleAnnotation.Applier
,FormDataAnnotation.Applier
,HeaderAnnotation.Applier
,HtmlAnnotation.Apply
,HtmlConfigAnnotation.ParserApply
,HtmlConfigAnnotation.SerializerApply
,HtmlDocConfigAnnotation.SerializerApply
,HtmlLinkAnnotation.Apply
,JsonAnnotation.Apply
,JsonConfigAnnotation.ParserApply
,JsonConfigAnnotation.SerializerApply
,JsonSchemaConfigAnnotation.Apply
,MarshalledAnnotation.Applier
,MsgPackAnnotation.Apply
,MsgPackConfigAnnotation.ParserApply
,MsgPackConfigAnnotation.SerializerApply
,NamePropertyAnnotation.Applier
,OpenApiAnnotation.Apply
,OpenApiConfigAnnotation.ParserApply
,OpenApiConfigAnnotation.SerializerApply
,ParentPropertyAnnotation.Applier
,ParserConfigAnnotation.InputStreamParserApply
,ParserConfigAnnotation.ParserApply
,ParserConfigAnnotation.ReaderParserApply
,PathAnnotation.Applier
,PlainTextAnnotation.Apply
,PlainTextConfigAnnotation.ParserApply
,PlainTextConfigAnnotation.SerializerApply
,QueryAnnotation.Applier
,RequestAnnotation.Applier
,ResponseAnnotation.Applier
,RestAnnotation.RestContextApply
,RestAnnotation.RestOpContextApply
,RestDeleteAnnotation.RestOpContextApply
,RestGetAnnotation.RestOpContextApply
,RestOpAnnotation.RestOpContextApply
,RestOptionsAnnotation.RestOpContextApply
,RestPatchAnnotation.RestOpContextApply
,RestPostAnnotation.RestOpContextApply
,RestPutAnnotation.RestOpContextApply
,SchemaAnnotation.Apply
,SerializerConfigAnnotation.OutputStreamSerializerApply
,SerializerConfigAnnotation.SerializerApply
,SerializerConfigAnnotation.WriterSerializerApply
,SoapXmlAnnotation.Apply
,SoapXmlConfigAnnotation.SerializerApply
,StatusCodeAnnotation.Applier
,SwapAnnotation.Applier
,UonAnnotation.Apply
,UonConfigAnnotation.ParserApply
,UonConfigAnnotation.SerializerApply
,UriAnnotation.Applier
,UrlEncodingAnnotation.Apply
,UrlEncodingConfigAnnotation.ParserApply
,UrlEncodingConfigAnnotation.SerializerApply
,XmlAnnotation.Apply
,XmlConfigAnnotation.ParserApply
,XmlConfigAnnotation.SerializerApply
BeanContext.Builder
) from an annotation (e.g. BeanConfig
).
Used by Context.Builder.applyAnnotations(Class...)
and Context.Builder.applyAnnotations(java.lang.reflect.Method...)
to apply
annotations to context beans.
The following code shows the general design pattern.
See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a no-op configuration apply. -
Constructor Summary
ModifierConstructorDescriptionprotected
AnnotationApplier
(Class<A> annotationClass, Class<B> builderClass, VarResolverSession vr) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
apply
(AnnotationInfo<A> annotationInfo, B builder) Apply the specified annotation to the specified property store builder.Resolves the specified string and converts it to a boolean.boolean
Returnstrue if this apply can be appied to the specified builder.Resolves the specified string as a comma-delimited list of strings.Resolves the specified string and converts it to a Character.Resolves the specified string and converts it to a Charset.Returns the specified class array as anOptional
.Class<?>
Returns the builder class that this applier applies to.Resolves the specified string and converts it to an int.Resolves the specified string as a comma-delimited list of strings.Resolves the specified string.Returns the specified string array as anOptional
.Returns the specified value if it's simple name is not"void" .protected VarResolverSession
vr()
Returns the var resolver session for this apply.
-
Constructor Details
-
AnnotationApplier
Constructor.- Parameters:
annotationClass
- The annotation class.builderClass
- The annotation class.vr
- The string resolver to use for resolving strings.
-
-
Method Details
-
apply
Apply the specified annotation to the specified property store builder.- Parameters:
annotationInfo
- The annotation.builder
- The property store builder.
-
canApply
Returnstrue if this apply can be appied to the specified builder.- Parameters:
builder
- The builder to check.- Returns:
true if this apply can be appied to the specified builder.
-
getBuilderClass
Returns the builder class that this applier applies to.- Returns:
- The builder class that this applier applies to.
-
vr
Returns the var resolver session for this apply.- Returns:
- The var resolver session for this apply.
-
string
Resolves the specified string.- Parameters:
in
- The string containing variables to resolve.- Returns:
- An optional containing the specified string if it exists, or
Optional.empty()
if it does not.
-
type
Returns the specified value if it's simple name is not"void" .- Type Parameters:
T
- The value to return.- Parameters:
in
- The value to return.- Returns:
- An optional containing the specified value.
-
strings
Returns the specified string array as anOptional
.If the array is empty, then returns
Optional.empty()
.- Parameters:
in
- The string array.- Returns:
- The array wrapped in an
Optional
.
-
stream
Resolves the specified string as a comma-delimited list of strings.- Parameters:
in
- The CDL string containing variables to resolve.- Returns:
- An array with resolved strings.
-
cdl
Resolves the specified string as a comma-delimited list of strings.- Parameters:
in
- The CDL string containing variables to resolve.- Returns:
- An array with resolved strings.
-
bool
Resolves the specified string and converts it to a boolean.- Parameters:
in
- The string containing variables to resolve.- Returns:
- The resolved boolean.
-
integer
Resolves the specified string and converts it to an int.- Parameters:
in
- The string containing variables to resolve.loc
- The annotation field name.- Returns:
- The resolved int.
-
charset
Resolves the specified string and converts it to a Charset.- Parameters:
in
- The string containing variables to resolve.- Returns:
- The resolved Charset.
-
character
Resolves the specified string and converts it to a Character.- Parameters:
in
- The string containing variables to resolve.loc
- The annotation field name.- Returns:
- The resolved Character.
-
classes
Returns the specified class array as anOptional
.If the array is empty, then returns
Optional.empty()
.- Parameters:
in
- The class array.- Returns:
- The array wrapped in an
Optional
.
-