| | |
| | | import org.opends.server.admin.DefaultBehaviorProvider; |
| | | import org.opends.server.admin.DefaultBehaviorProviderVisitor; |
| | | import org.opends.server.admin.DefinedDefaultBehaviorProvider; |
| | | import org.opends.server.admin.EnumPropertyDefinition; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.PropertyDefinition; |
| | | import org.opends.server.admin.PropertyOption; |
| | | import org.opends.server.admin.RelativeInheritedDefaultBehaviorProvider; |
| | | import org.opends.server.admin.UndefinedDefaultBehaviorProvider; |
| | | |
| | |
| | | * @throws Exception |
| | | * If an error occurs. |
| | | */ |
| | | @SuppressWarnings({ "unchecked", "unused" }) |
| | | @SuppressWarnings("unchecked") |
| | | private <T> Object getDefaultValue(ManagedObjectDefinition<?, ?> definition, |
| | | Method getPropertyDefMethod, Class<T> propertyReturnClass) throws Exception { |
| | | PropertyDefinition<T> propertyDefinition = (PropertyDefinition<T>) getPropertyDefMethod.invoke(definition); |
| | |
| | | MockProviderVisitor<T> visitor = new MockProviderVisitor<T>(propertyDefinition); |
| | | Collection<T> values = defaultBehaviorProvider.accept(visitor, null); |
| | | |
| | | if (propertyDefinition instanceof EnumPropertyDefinition) { |
| | | // enum values returned as a sorted set |
| | | if (propertyDefinition.hasOption(PropertyOption.MULTI_VALUED)) { |
| | | return values; |
| | | } else { |
| | | // single value returned |