@Retention(RUNTIME)
@Target({METHOD,FIELD,CONSTRUCTOR})
public static @interface Config.Transient
builder
and build
method.
The annotation cannot be applied on same JavaBean property together with Config.Value
.
In following example, property timestamp
is not set even timestamp
config value is available.
Property timestamp
is completely ignored by deserialization process.
public class AppConfig {
private Instant timestamp;
private String greeting;
@Config.Transient
public void setTimestamp(Instant timestamp) { // <1>
this.timestamp = timestamp;
}
public void setGreeting(String greeting) { // <2>
this.greeting = greeting;
}
//...
}
setTimestamp(Instant)
method is never called during deserialization.setGreeting(String)
can be called if greeting
config value is available.
{
"app" : {
"greeting" : "Hello",
"timestamp" : "2007-12-03T10:15:30.00Z"
}
}
Getting app
config node as AppConfig
instance:
AppConfig appConfig = config.get("app").as(AppConfig.class);
assert appConfig.getTimestamp() == null;
Config.Value
Copyright © 2018 Oracle Corporation. All rights reserved.