import-email-addresses #86
@ -20,8 +20,8 @@ services:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4'
|
||||
memory: 4G
|
||||
reservations:
|
||||
cpus: '2'
|
||||
memory: 8G
|
||||
reservations:
|
||||
cpus: '1'
|
||||
memory: 2G
|
||||
|
@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
|
||||
public interface PropertiesProvider {
|
||||
|
||||
boolean isLoaded();
|
||||
PatchableMapWrapper directProps();
|
||||
PatchableMapWrapper<Object> directProps();
|
||||
Object getContextValue(final String propName);
|
||||
|
||||
default <T> T getDirectValue(final String propName, final Class<T> clazz) {
|
||||
|
@ -100,7 +100,6 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
|
||||
|
||||
public P writeOnly() {
|
||||
this.writeOnly = true;
|
||||
optional(); // FIXME: sounds wrong
|
||||
return self();
|
||||
}
|
||||
|
||||
@ -260,11 +259,16 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
|
||||
}
|
||||
|
||||
public void verifyConsistency(final Map.Entry<? extends Enum<?>, ?> typeDef) {
|
||||
if (required == null && requiresAtLeastOneOf == null && requiresAtMaxOneOf == null && !readOnly && defaultValue == null) {
|
||||
if (isSpecPotentiallyComplete()) {
|
||||
throw new IllegalStateException(typeDef.getKey() + "[" + propertyName + "] not fully initialized, please call either .readOnly(), .required(), .optional(), .withDefault(...), .requiresAtLeastOneOf(...) or .requiresAtMaxOneOf(...)" );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSpecPotentiallyComplete() {
|
||||
return required == null && requiresAtLeastOneOf == null && requiresAtMaxOneOf == null && !readOnly && !writeOnly
|
||||
&& defaultValue == null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getValue(final Map<String, Object> propValues) {
|
||||
return (T) Optional.ofNullable(propValues.get(propertyName)).orElse(defaultValue);
|
||||
|
Loading…
Reference in New Issue
Block a user