import-email-addresses #86

Merged
hsh-michaelhoennig merged 18 commits from import-email-addresses into master 2024-08-12 12:06:12 +02:00
3 changed files with 10 additions and 6 deletions
Showing only changes of commit 286dc4b1a9 - Show all commits

View File

@ -20,8 +20,8 @@ services:
deploy:
resources:
limits:
cpus: '4'
memory: 4G
reservations:
cpus: '2'
memory: 8G
reservations:
cpus: '1'
memory: 2G

View File

@ -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) {

View File

@ -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);