org.opends.server.types
Class VirtualAttribute

java.lang.Object
  extended by org.opends.server.types.Attribute
      extended by org.opends.server.types.VirtualAttribute

@PublicAPI(stability=VOLATILE,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class VirtualAttribute
extends Attribute

This class defines a virtual attribute, which is a special kind of attribute whose values do not actually exist in persistent storage but rather are computed or otherwise obtained dynamically.


Constructor Summary
VirtualAttribute(AttributeType attributeType, Entry entry, VirtualAttributeRule rule)
          Creates a new virtual attribute with the provided information.
 
Method Summary
 ConditionResult approximatelyEqualTo(AttributeValue value)
          Indicates whether this attribute has any value(s) that are approximately equal to the provided value.
 Attribute duplicate(boolean omitValues)
          Creates a duplicate of this attribute that can be modified without impacting this attribute.
 Entry getEntry()
          Retrieves the entry in which this virtual attribute exists.
 java.util.LinkedHashSet<AttributeValue> getValues()
          Retrieves the set of values for this attribute.
 VirtualAttributeRule getVirtualAttributeRule()
          Retrieves the virtual attribute rule that governs the behavior of this virtual attribute.
 ConditionResult greaterThanOrEqualTo(AttributeValue value)
          Indicates whether this attribute has any value(s) that are greater than or equal to the provided value.
 boolean hasAllValues(java.util.Collection<AttributeValue> values)
          Indicates whether this attribute contains all the values in the collection.
 boolean hasAnyValue(java.util.Collection<AttributeValue> values)
          Indicates whether this attribute contains any of the values in the collection.
 boolean hasValue()
          Indicates whether this attribute contains one or more values.
 boolean hasValue(AttributeValue value)
          Indicates whether this attribute contains the specified value.
 boolean isVirtual()
          Indicates whether this is a virtual attribute rather than a real attribute.
 ConditionResult lessThanOrEqualTo(AttributeValue value)
          Indicates whether this attribute has any value(s) that are less than or equal to the provided value.
 ConditionResult matchesSubstring(ByteString subInitial, java.util.List<ByteString> subAny, ByteString subFinal)
          Indicates whether this attribute has any value(s) that match the provided substring.
 void toString(java.lang.StringBuilder buffer)
          Appends a one-line string representation of this attribute to the provided buffer.
 
Methods inherited from class org.opends.server.types.Attribute
duplicate, equals, getAttributeType, getName, getNameWithOptions, getOptions, hashCode, hasOption, hasOptions, hasOptions, optionsEqual, setValues, toLDIF, toLDIF, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtualAttribute

public VirtualAttribute(AttributeType attributeType,
                        Entry entry,
                        VirtualAttributeRule rule)
Creates a new virtual attribute with the provided information.

Parameters:
attributeType - The attribute type for this virtual attribute.
entry - The entry in which this virtual attribute exists.
rule - The virutal attribute rule that governs the behavior of this virtual attribute.
Method Detail

getEntry

public Entry getEntry()
Retrieves the entry in which this virtual attribute exists.

Returns:
The entry in which this virtual attribute exists.

getVirtualAttributeRule

public VirtualAttributeRule getVirtualAttributeRule()
Retrieves the virtual attribute rule that governs the behavior of this virtual attribute.

Returns:
The virtual attribute rule that governs the behavior of this virtual attribute.

getValues

public java.util.LinkedHashSet<AttributeValue> getValues()
Retrieves the set of values for this attribute. The returned set of values may be altered by the caller.

Overrides:
getValues in class Attribute
Returns:
The set of values for this attribute.

hasValue

public boolean hasValue()
Indicates whether this attribute contains one or more values.

Overrides:
hasValue in class Attribute
Returns:
true if this attribute contains one or more values, or false if it does not.

hasValue

public boolean hasValue(AttributeValue value)
Indicates whether this attribute contains the specified value.

Overrides:
hasValue in class Attribute
Parameters:
value - The value for which to make the determination.
Returns:
true if this attribute has the specified value, or false if not.

hasAllValues

public boolean hasAllValues(java.util.Collection<AttributeValue> values)
Indicates whether this attribute contains all the values in the collection.

Overrides:
hasAllValues in class Attribute
Parameters:
values - The set of values for which to make the determination.
Returns:
true if this attribute contains all the values in the provided collection, or false if it does not contain at least one of them.

hasAnyValue

public boolean hasAnyValue(java.util.Collection<AttributeValue> values)
Indicates whether this attribute contains any of the values in the collection.

Overrides:
hasAnyValue in class Attribute
Parameters:
values - The set of values for which to make the determination.
Returns:
true if this attribute contains at least one of the values in the provided collection, or false if it does not contain any of the values.

matchesSubstring

public ConditionResult matchesSubstring(ByteString subInitial,
                                        java.util.List<ByteString> subAny,
                                        ByteString subFinal)
Indicates whether this attribute has any value(s) that match the provided substring.

Overrides:
matchesSubstring in class Attribute
Parameters:
subInitial - The subInitial component to use in the determination.
subAny - The subAny components to use in the determination.
subFinal - The subFinal component to use in the determination.
Returns:
UNDEFINED if this attribute does not have a substring matching rule, TRUE if at least one value matches the provided substring, or FALSE otherwise.

greaterThanOrEqualTo

public ConditionResult greaterThanOrEqualTo(AttributeValue value)
Indicates whether this attribute has any value(s) that are greater than or equal to the provided value.

Overrides:
greaterThanOrEqualTo in class Attribute
Parameters:
value - The value for which to make the determination.
Returns:
UNDEFINED if this attribute does not have an ordering matching rule, TRUE if at least one value is greater than or equal to the provided value, or false otherwise.

lessThanOrEqualTo

public ConditionResult lessThanOrEqualTo(AttributeValue value)
Indicates whether this attribute has any value(s) that are less than or equal to the provided value.

Overrides:
lessThanOrEqualTo in class Attribute
Parameters:
value - The value for which to make the determination.
Returns:
UNDEFINED if this attribute does not have an ordering matching rule, TRUE if at least one value is less than or equal to the provided value, or false otherwise.

approximatelyEqualTo

public ConditionResult approximatelyEqualTo(AttributeValue value)
Indicates whether this attribute has any value(s) that are approximately equal to the provided value.

Overrides:
approximatelyEqualTo in class Attribute
Parameters:
value - The value for which to make the determination.
Returns:
UNDEFINED if this attribute does not have an approximate matching rule, TRUE if at least one value is approximately equal to the provided value, or false otherwise.

isVirtual

public boolean isVirtual()
Indicates whether this is a virtual attribute rather than a real attribute.

Overrides:
isVirtual in class Attribute
Returns:
true if this is a virtual attribute, or false if it is a real attribute.

duplicate

public Attribute duplicate(boolean omitValues)
Creates a duplicate of this attribute that can be modified without impacting this attribute.

Overrides:
duplicate in class Attribute
Parameters:
omitValues - true if the values should be omitted.
Returns:
A duplicate of this attribute that can be modified without impacting this attribute.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a one-line string representation of this attribute to the provided buffer.

Overrides:
toString in class Attribute
Parameters:
buffer - The buffer to which the information should be appended.