/**
* {@inheritDoc} <p/>This implementation will build the {@link OAuthAppSettings} from a {@link ResourceBundle}<p/> It'll first try to load all binding (mandatory) fields from the bundle by looking for the key prefix.fieldName (or fieldName if prefix is empty) <p/> In a second time it'll check if optional fields are present in the bundle (with the same key construction) and load them if they are. If they are not present it'll try to load them without prefix
* @return the built OAuthAppSettings
* @throws java.util.MissingResourceException if the bundle can't be open
* @throws AgoravaException if a binding field is missing in the bundle
*/
@Override public OAuthAppSettings build(){
String key;
String value;
Joiner kj=Joiner.on('.').skipNulls();
ResourceBundle rb=ResourceBundle.getBundle(bundleName);
for ( String k : bindingKeys) {
key=kj.join(prefix,k);
if (!rb.containsKey(key)) {
throw new AgoravaException("Unable to find binding key: " + key + " in bundle "+ bundleName+ " to build settings");
}
value=rb.getString(key);
invokeSetter(k,value);
}
for ( String k : optionalKeys) {
key=kj.join(prefix,k);
if (rb.containsKey(key)) {
value=rb.getString(key);
invokeSetter(k,value);
}
else if (rb.containsKey(k)) {
value=rb.getString(k);
invokeSetter(k,value);
}
}
return super.build();
}

Example 36

From project Archimedes, under directory /br.org.archimedes.offset/src/br/org/archimedes/offset/.