Package io.helidon.config.objectmapping
Annotation Type Transient
-
@Retention(RUNTIME) @Target({METHOD,FIELD,CONSTRUCTOR}) public @interface Transient
Annotation used to exclude JavaBean property, method or constructor from JavaBean deserialization support. The annotation can be used on JavaBean property public setter, on public property field, on public constructor or on publicbuilder
andbuild
method.The annotation cannot be applied on same JavaBean property together with
Value
.In following example, property
timestamp
is not set eventimestamp
config value is available. Propertytimestamp
is completely ignored by deserialization process.public class AppConfig { private Instant timestamp; private String greeting; @Transient public void setTimestamp(Instant timestamp) { // <1> this.timestamp = timestamp; } public void setGreeting(String greeting) { // <2> this.greeting = greeting; } //... }
- The
setTimestamp(Instant)
method is never called during deserialization. - While
setGreeting(String)
can be called ifgreeting
config value is available.
Getting{ "app" : { "greeting" : "Hello", "timestamp" : "2007-12-03T10:15:30.00Z" } }
app
config node asAppConfig
instance:AppConfig appConfig = config.get("app").as(AppConfig.class); assert appConfig.getTimestamp() == null;
- See Also:
Value
- The