org.opends.server.admin
Class PropertyValueVisitor<R,P>

java.lang.Object
  extended by org.opends.server.admin.PropertyValueVisitor<R,P>
Type Parameters:
R - The return type of this visitor's methods. Use Void for visitors that do not need to return results.
P - The type of the additional parameter to this visitor's methods. Use Void for visitors that do not need an additional parameter.

public abstract class PropertyValueVisitor<R,P>
extends java.lang.Object

A visitor of property values, in the style of the visitor design pattern. Classes implementing this interface can query a property a value and its associated property definition in a type-safe manner when the kind of property value is unknown at compile time. When a visitor is passed to a property definition's accept method, the corresponding visit method most applicable to that property definition is invoked.

Each visitXXX method is provided with a default implementation which calls visitUnknown(PropertyDefinition, Object, Object). Sub-classes can override any or all of the methods to provide their own type-specific behavior.


Constructor Summary
protected PropertyValueVisitor()
          Default constructor.
 
Method Summary
 R visitACI(ACIPropertyDefinition pd, Aci v, P p)
          Visit a dseecompat ACI.
<C extends ConfigurationClient,S extends Configuration>
R
visitAggregation(AggregationPropertyDefinition<C,S> pd, java.lang.String v, P p)
          Visit an aggregation property value.
 R visitAttributeType(AttributeTypePropertyDefinition pd, AttributeType v, P p)
          Visit an attribute type.
 R visitBoolean(BooleanPropertyDefinition pd, java.lang.Boolean v, P p)
          Visit a boolean.
 R visitClass(ClassPropertyDefinition pd, java.lang.String v, P p)
          Visit a class.
 R visitDN(DNPropertyDefinition pd, DN v, P p)
          Visit a DN.
 R visitDuration(DurationPropertyDefinition pd, java.lang.Long v, P p)
          Visit a duration.
<E extends java.lang.Enum<E>>
R
visitEnum(EnumPropertyDefinition<E> pd, E v, P p)
          Visit an enumeration.
 R visitInteger(IntegerPropertyDefinition pd, java.lang.Integer v, P p)
          Visit an integer.
 R visitIPAddress(IPAddressPropertyDefinition pd, java.net.InetAddress v, P p)
          Visit a IP address.
 R visitIPAddressMask(IPAddressMaskPropertyDefinition pd, AddressMask v, P p)
          Visit a IP address mask.
 R visitSize(SizePropertyDefinition pd, java.lang.Long v, P p)
          Visit a size.
 R visitString(StringPropertyDefinition pd, java.lang.String v, P p)
          Visit a string.
<T> R
visitUnknown(PropertyDefinition<T> pd, T v, P p)
          Visit an unknown type of property value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyValueVisitor

protected PropertyValueVisitor()
Default constructor.

Method Detail

visitACI

public R visitACI(ACIPropertyDefinition pd,
                  Aci v,
                  P p)
Visit a dseecompat ACI.

Parameters:
pd - The dseecompat ACI property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitAggregation

public <C extends ConfigurationClient,S extends Configuration> R visitAggregation(AggregationPropertyDefinition<C,S> pd,
                                                                                  java.lang.String v,
                                                                                  P p)
Visit an aggregation property value.

Type Parameters:
C - The type of client managed object configuration that this aggregation property definition refers to.
S - The type of server managed object configuration that this aggregation property definition refers to.
Parameters:
pd - The aggregation property definition to visit.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitAttributeType

public R visitAttributeType(AttributeTypePropertyDefinition pd,
                            AttributeType v,
                            P p)
Visit an attribute type.

Parameters:
pd - The attribute type property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitBoolean

public R visitBoolean(BooleanPropertyDefinition pd,
                      java.lang.Boolean v,
                      P p)
Visit a boolean.

Parameters:
pd - The boolean property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitClass

public R visitClass(ClassPropertyDefinition pd,
                    java.lang.String v,
                    P p)
Visit a class.

Parameters:
pd - The class property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitDN

public R visitDN(DNPropertyDefinition pd,
                 DN v,
                 P p)
Visit a DN.

Parameters:
pd - The DN property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitDuration

public R visitDuration(DurationPropertyDefinition pd,
                       java.lang.Long v,
                       P p)
Visit a duration.

Parameters:
pd - The duration property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitEnum

public <E extends java.lang.Enum<E>> R visitEnum(EnumPropertyDefinition<E> pd,
                                                 E v,
                                                 P p)
Visit an enumeration.

Type Parameters:
E - The enumeration that should be used for values of the property definition.
Parameters:
pd - The enumeration property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitInteger

public R visitInteger(IntegerPropertyDefinition pd,
                      java.lang.Integer v,
                      P p)
Visit an integer.

Parameters:
pd - The integer property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitIPAddress

public R visitIPAddress(IPAddressPropertyDefinition pd,
                        java.net.InetAddress v,
                        P p)
Visit a IP address.

Parameters:
pd - The IP address property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitIPAddressMask

public R visitIPAddressMask(IPAddressMaskPropertyDefinition pd,
                            AddressMask v,
                            P p)
Visit a IP address mask.

Parameters:
pd - The IP address mask property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitSize

public R visitSize(SizePropertyDefinition pd,
                   java.lang.Long v,
                   P p)
Visit a size.

Parameters:
pd - The size property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitString

public R visitString(StringPropertyDefinition pd,
                     java.lang.String v,
                     P p)
Visit a string.

Parameters:
pd - The string property definition.
v - The property value to visit.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.

visitUnknown

public <T> R visitUnknown(PropertyDefinition<T> pd,
                          T v,
                          P p)
               throws UnknownPropertyDefinitionException
Visit an unknown type of property value. Implementations of this method can provide default behavior for unknown types of property.

The default implementation of this method throws an UnknownPropertyDefinitionException. Sub-classes can override this method with their own default behavior.

Type Parameters:
T - The type of property value to visit.
Parameters:
pd - The property definition.
v - The property value.
p - A visitor specified parameter.
Returns:
Returns a visitor specified result.
Throws:
UnknownPropertyDefinitionException - Visitor implementations may optionally throw this exception.