com.bea.content
Class PropertyChoice

java.lang.Object
  extended by com.bea.content.ContentEntity
      extended by com.bea.content.PropertyChoice
All Implemented Interfaces
Serializable, Cloneable

public class PropertyChoice
extends ContentEntity
implements Cloneable

PropertyChoice defines a set of choices for a PropertyDefinition, and thus any Property instances based on it.

A choice can be a default, which means if the creator of a Property does not choose different values, it will be set as a Property value. By default, isDefault is false.

If the PropertyChoice value is defined as null, it allows for an empty choice. For example, a Property that has a String type could have 3 PropertyChoices - "blue", "red" and null.

See Also
Serialized Form

Field Summary
 
Fields inherited from class com.bea.content.ContentEntity
id
 
Constructor Summary
PropertyChoice()
          Empty value constructor for a null PropertyChoice.
PropertyChoice(ID id, BinaryValue binaryValue)
          BinaryValue constructor with id.
PropertyChoice(ID id, BinaryValue binaryValue, Boolean booleanValue, Calendar calendarValue, Double doubleValue, boolean isDefault, Long longValue, String stringValue)
          Constructor with all values.
PropertyChoice(ID id, Boolean booleanValue)
          Boolean constructor with id.
PropertyChoice(ID id, Calendar calendarValue)
          Calendar constructor.
PropertyChoice(ID id, Double doubleValue)
          Double constructor.
PropertyChoice(ID id, Long longValue)
          Long constructor.
PropertyChoice(ID id, String stringValue)
          String constructor.
 
Method Summary
 Object clone()
          Clones a PropertyChoice Note that binary property choice streams are not cloned, but merely copied.
 int compareTo(Object obj)
          Compares this PropertyChoices to obj.
 BinaryValue getBinaryValue()
          Gets the BinaryValue.
 Boolean getBooleanValue()
          The Boolean choice can be true, false, or null.
 Calendar getCalendarValue()
          The Calendar choice can be a Calendar instance, or null.
 Double getDoubleValue()
          The Double choice can be a Double instance, or null.
 Long getLongValue()
          The Long choice can be a Long instance, or null.
 int getOrderedPosition()
          If multivalued property, the position dictates the order
 String getStringValue()
          The String choice can be a String instance, or null.
 Object getValue()
          Gets the Value as an Object.
 Object getValueByType(int type)
          Return the correct value based on the type.
 boolean isDefault()
          Returns true if this PropertyChoice is a default.
 void isDefault(boolean isDefault)
          Sets if this PropertyChoice is a default.
 boolean isObjectClassReadOnly()
          A flag indicating if the ObjectClass is read-only because the repository does not support write operations or isn't configured to allow write access to ObjectClasses.
 void setBinaryValue(BinaryValue binaryValue)
          Sets the BinaryValue.
 void setBooleanValue(Boolean booleanValue)
          Sets the Boolean value to true, false or null.
 void setCalendarValue(Calendar calendarValue)
          Sets the Calendar value.
 void setDefault(boolean isDefault)
          Sets if this PropertyChoice is a Default.
 void setDoubleValue(Double doubleValue)
          Sets the Double value.
 void setLongValue(Long longValue)
          Sets the Long value.
 void setOrderedPosition(int position)
          Set the position dictating the order of the PropertyChoice array on an ObjectClass
 void setStringValue(String stringValue)
          Sets the String value.
 String toString()
          Returns the PropertyChoice attributes as a String.
 
Methods inherited from class com.bea.content.ContentEntity
getId, setId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyChoice

public PropertyChoice()
Empty value constructor for a null PropertyChoice.


PropertyChoice

public PropertyChoice(ID id,
                      BinaryValue binaryValue,
                      Boolean booleanValue,
                      Calendar calendarValue,
                      Double doubleValue,
                      boolean isDefault,
                      Long longValue,
                      String stringValue)
Constructor with all values.


PropertyChoice

public PropertyChoice(ID id,
                      BinaryValue binaryValue)
BinaryValue constructor with id. IsDefault defaults to false.


PropertyChoice

public PropertyChoice(ID id,
                      Boolean booleanValue)
Boolean constructor with id. IsDefault defaults to false.


PropertyChoice

public PropertyChoice(ID id,
                      Calendar calendarValue)
Calendar constructor. IsDefault defaults to false.


PropertyChoice

public PropertyChoice(ID id,
                      Double doubleValue)
Double constructor. IsDefault defaults to false.


PropertyChoice

public PropertyChoice(ID id,
                      Long longValue)
Long constructor. IsDefault defaults to false.


PropertyChoice

public PropertyChoice(ID id,
                      String stringValue)
String constructor. IsDefault defaults to false.

Method Detail

setDefault

public void setDefault(boolean isDefault)
Sets if this PropertyChoice is a Default.


getBinaryValue

public BinaryValue getBinaryValue()
Gets the BinaryValue.


setBinaryValue

public void setBinaryValue(BinaryValue binaryValue)
Sets the BinaryValue.


getBooleanValue

public Boolean getBooleanValue()
The Boolean choice can be true, false, or null.


setBooleanValue

public void setBooleanValue(Boolean booleanValue)
Sets the Boolean value to true, false or null.


getCalendarValue

public Calendar getCalendarValue()
The Calendar choice can be a Calendar instance, or null.


setCalendarValue

public void setCalendarValue(Calendar calendarValue)
Sets the Calendar value.


getDoubleValue

public Double getDoubleValue()
The Double choice can be a Double instance, or null.


setDoubleValue

public void setDoubleValue(Double doubleValue)
Sets the Double value.


getLongValue

public Long getLongValue()
The Long choice can be a Long instance, or null.


setLongValue

public void setLongValue(Long longValue)
Sets the Long value.


getStringValue

public String getStringValue()
The String choice can be a String instance, or null.


setStringValue

public void setStringValue(String stringValue)
Sets the String value.


getOrderedPosition

public int getOrderedPosition()
If multivalued property, the position dictates the order

Note: If this Value is set on more than one property, this position cannot be different for each Property. It is best to avoid setting the position if this Value is going to be added to multiple properties.

Returns
The ordered position.

setOrderedPosition

public void setOrderedPosition(int position)
Set the position dictating the order of the PropertyChoice array on an ObjectClass

Note: If this PropertyChoice is set on more than one ObjectClass, this position cannot be different for each ObjectClass. It is best to avoid setting the position if this PropertyChoice is going to be added to multiple ObjectClass objects.

Parameters
position - The position of this PropertyChoice in the array, if applicable

getValueByType

public Object getValueByType(int type)
Return the correct value based on the type. The user will then cast it to the appropriate object.


getValue

public Object getValue()
Gets the Value as an Object.


isDefault

public void isDefault(boolean isDefault)
Sets if this PropertyChoice is a default.


isDefault

public boolean isDefault()
Returns true if this PropertyChoice is a default. There can only be one default per set of PropertyChoices for a PropertyDefinition.


compareTo

public int compareTo(Object obj)
Compares this PropertyChoices to obj. This performs a native compare on all types, except Calendar is compared based on the time in milliseconds and BinaryValue is compared by name.


toString

public String toString()
Returns the PropertyChoice attributes as a String.

Overrides:
toString in class ContentEntity

isObjectClassReadOnly

public boolean isObjectClassReadOnly()
A flag indicating if the ObjectClass is read-only because the repository does not support write operations or isn't configured to allow write access to ObjectClasses. If an ObjectClass is read-only, then calling a setter on the ObjectClass or one of its dependent objects (e.g. PropertyDefinition) will thrown a RepositoryRuntimeException when the setter is called.

Returns
true if the ObjectClass is read-only.

clone

public Object clone()
             throws CloneNotSupportedException
Clones a PropertyChoice Note that binary property choice streams are not cloned, but merely copied.

Overrides:
clone in class ContentEntity
Returns
A clone of the PropertyChoice.
Throws
CloneNotSupportedException - If the clone fails.


Copyright © 2011, Oracle. All rights reserved.