| | |
| | | */ |
| | | public static final class Builder extends AbstractBuilder<String, StringPropertyDefinition> { |
| | | |
| | | // Flag indicating whether values of this property are |
| | | // case-insensitive. |
| | | /** |
| | | * Flag indicating whether values of this property are |
| | | * case-insensitive. |
| | | */ |
| | | private boolean isCaseInsensitive = true; |
| | | |
| | | // Optional pattern which values of this property must match. |
| | | /** Optional pattern which values of this property must match. */ |
| | | private Pattern pattern = null; |
| | | |
| | | // Pattern usage which provides a user-friendly summary of the |
| | | // pattern if present. |
| | | /** |
| | | * Pattern usage which provides a user-friendly summary of the |
| | | * pattern if present. |
| | | */ |
| | | private String patternUsage = null; |
| | | |
| | | // Private constructor |
| | | /** Private constructor. */ |
| | | private Builder(AbstractManagedObjectDefinition<?, ?> d, String propertyName) { |
| | | super(d, propertyName); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected StringPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?, ?> d, |
| | | String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction, |
| | |
| | | return new Builder(d, propertyName); |
| | | } |
| | | |
| | | // Flag indicating whether values of this property are |
| | | // case-insensitive. |
| | | /** |
| | | * Flag indicating whether values of this property are |
| | | * case-insensitive. |
| | | */ |
| | | private final boolean isCaseInsensitive; |
| | | |
| | | // Optional pattern which values of this property must match. |
| | | /** Optional pattern which values of this property must match. */ |
| | | private final Pattern pattern; |
| | | |
| | | // Pattern usage which provides a user-friendly summary of the |
| | | // pattern if present. |
| | | /** |
| | | * Pattern usage which provides a user-friendly summary of the |
| | | * pattern if present. |
| | | */ |
| | | private final String patternUsage; |
| | | |
| | | // Private constructor. |
| | | /** Private constructor. */ |
| | | private StringPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName, |
| | | EnumSet<PropertyOption> options, AdministratorAction adminAction, |
| | | DefaultBehaviorProvider<String> defaultBehavior, boolean isCaseInsensitive, Pattern pattern, |
| | |
| | | this.patternUsage = patternUsage; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) { |
| | | return v.visitString(this, p); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <R, P> R accept(PropertyValueVisitor<R, P> v, String value, P p) { |
| | | return v.visitString(this, value, p); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String decodeValue(String value) { |
| | | Reject.ifNull(value); |
| | |
| | | return isCaseInsensitive; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String normalizeValue(String value) { |
| | | Reject.ifNull(value); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void validateValue(String value) { |
| | | Reject.ifNull(value); |