| | |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | import static com.forgerock.opendj.util.Validator.*; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import java.util.Comparator; |
| | | import java.util.EnumSet; |
| | |
| | | * The administrator action. |
| | | */ |
| | | public final void setAdministratorAction(AdministratorAction adminAction) { |
| | | ensureNotNull(adminAction); |
| | | Reject.ifNull(adminAction); |
| | | this.adminAction = adminAction; |
| | | } |
| | | |
| | |
| | | * The default behavior provider. |
| | | */ |
| | | public final void setDefaultBehaviorProvider(DefaultBehaviorProvider<T> defaultBehavior) { |
| | | ensureNotNull(defaultBehavior); |
| | | Reject.ifNull(defaultBehavior); |
| | | this.defaultBehavior = defaultBehavior; |
| | | } |
| | | |
| | |
| | | * The property option. |
| | | */ |
| | | public final void setOption(PropertyOption option) { |
| | | ensureNotNull(option); |
| | | Reject.ifNull(option); |
| | | options.add(option); |
| | | } |
| | | |
| | |
| | | */ |
| | | protected PropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, Class<T> theClass, String propertyName, |
| | | EnumSet<PropertyOption> options, AdministratorAction adminAction, DefaultBehaviorProvider<T> defaultBehavior) { |
| | | ensureNotNull(d, theClass, propertyName); |
| | | ensureNotNull(options, adminAction, defaultBehavior); |
| | | Reject.ifNull(d); |
| | | Reject.ifNull(theClass); |
| | | Reject.ifNull(propertyName); |
| | | Reject.ifNull(options); |
| | | Reject.ifNull(adminAction); |
| | | Reject.ifNull(defaultBehavior); |
| | | |
| | | this.definition = d; |
| | | this.theClass = theClass; |
| | |
| | | * argument is less than, equal to, or greater than the second. |
| | | */ |
| | | public int compare(T o1, T o2) { |
| | | ensureNotNull(o1, o2); |
| | | Reject.ifNull(o1); |
| | | Reject.ifNull(o2); |
| | | |
| | | String s1 = normalizeValue(o1); |
| | | String s2 = normalizeValue(o2); |
| | |
| | | * If the property value is invalid. |
| | | */ |
| | | public String encodeValue(T value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | Reject.ifNull(value); |
| | | |
| | | return value.toString(); |
| | | } |
| | |
| | | * If the property value is invalid. |
| | | */ |
| | | public String normalizeValue(T value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | Reject.ifNull(value); |
| | | |
| | | return encodeValue(value); |
| | | } |