[New] Added StringParamBuilder.enumeration()

This commit is contained in:
Robert von Burg 2021-05-29 22:12:57 +02:00
parent db8592db41
commit cf37ef8a2c
2 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,12 @@ public class StrolchModelConstants {
public static final String SUFFIX_REF = "-Ref";
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as an
* enumeration
*/
public static final String INTERPRETATION_ENUMERATION = "Enumeration"; //$NON-NLS-1$
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to a {@link Resource}

View File

@ -31,6 +31,13 @@ public class StringParamBuilder<T extends ParameterBagContainerBuilder<T>>
return this;
}
public StringParamBuilder<T> enumeration(Enum<?> defaultValue) {
this.interpretation = INTERPRETATION_ENUMERATION;
this.uom = defaultValue.getDeclaringClass().getSimpleName();
value(defaultValue.name());
return this;
}
@Override
public StringParameter build() {
return build(new StringParameter());