@Documented @Target(value=CONSTRUCTOR) @Retention(value=RUNTIME) @Inherited public @interface BeanConstructor
This annotation can be used in the case of beans with properties whose values can only be set by passing them in
through a constructor on the class.
Since method parameter names are lost during compilation, this annotation essentially redefines them so that they
are available at runtime.
This annotation can only be applied to constructors and can only be applied to one constructor per class.
When present, bean instantiation is delayed until the call to BeanMap.getBean()
.
Until then, bean property values are stored in a local cache until getBean()
is called.
Because of this additional caching step, parsing into read-only beans tends to be slower and use more memory than
parsing into beans with writable properties.
Attempting to call BeanMap.put(String,Object)
on a read-only property after calling BeanMap.getBean()
will result in a BeanRuntimeException
being thrown.
Multiple calls to BeanMap.getBean()
will return the same bean instance.
Modifier and Type | Optional Element and Description |
---|---|
String |
properties
The names of the properties of the constructor arguments.
|
public abstract String properties
The number of properties listed must match the number of arguments in the constructor.
Copyright © 2018 Apache. All rights reserved.