Package com.nomagic.magicdraw.properties
Class BooleanProperty
- java.lang.Object
-
- com.nomagic.magicdraw.properties.Property
-
- com.nomagic.magicdraw.properties.BooleanProperty
-
- All Implemented Interfaces:
PropertyVisitorAcceptor
,java.lang.Cloneable
@OpenApiAll public class BooleanProperty extends Property
The property for storing and editing boolean value.
-
-
Field Summary
-
Fields inherited from class com.nomagic.magicdraw.properties.Property
DEFAULT_PROPERTY_RESOURCE_PROVIDER, EDITABLE, NULL, NULL_ID_PROPERTY_RESOURCE_PROVIDER, UNDEFINED, VALUE
-
-
Constructor Summary
Constructors Constructor Description BooleanProperty()
Default constructor.BooleanProperty(java.lang.String id, boolean value)
The boolean property constructor.BooleanProperty(java.lang.String id, java.lang.Boolean value)
The boolean property constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(PropertyVisitor v)
Accepts the given visitor.BooleanProperty
clone()
Clones the property.boolean
getBoolean()
Returns value as boolean (primitive type).java.lang.Boolean
getBooleanObject()
Returns value asBoolean
object.java.lang.String
getClassType()
Returns property class type.static java.lang.String
getStringRepresentation(java.lang.Boolean value)
Returns value's string representation.java.lang.String
getValueStringRepresentation()
Returns value's string representation.protected boolean
isValueCompatible(java.lang.Object value)
void
setValue(boolean value)
Sets value as primitive boolean type.void
setValue(java.lang.Object value)
Sets boolean value from given Object.-
Methods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addPropertyChangeListener, addSource, addSources, areValuesEqual, checkFrozen, checkFrozen, createCellEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getDescription, getDescriptionID, getFirstElementFromSources, getGroup, getID, getIntroductoryVersion, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSourceAsElement, getSources, getSourcesAsStream, getUndefinedString, getUndefinedString, getValue, hashCode, isEditable, isUndefinedState, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
-
-
-
-
Constructor Detail
-
BooleanProperty
public BooleanProperty()
Default constructor. Value of the property will be false. ID will be empty string.
-
BooleanProperty
public BooleanProperty(java.lang.String id, @CheckForNull java.lang.Boolean value)
The boolean property constructor.- Parameters:
id
- the ID of property.value
- the boolean value of the property.
-
BooleanProperty
public BooleanProperty(java.lang.String id, boolean value)
The boolean property constructor.- Parameters:
id
- the ID of the property.value
- the boolean value of the property.
-
-
Method Detail
-
getValueStringRepresentation
public java.lang.String getValueStringRepresentation()
Returns value's string representation.- Overrides:
getValueStringRepresentation
in classProperty
- Returns:
- string "True", "False" or "?" if property does not have value.
-
getStringRepresentation
public static java.lang.String getStringRepresentation(@CheckForNull java.lang.Boolean value)
Returns value's string representation.- Parameters:
value
- The given value.- Returns:
- String representation.
-
accept
public void accept(PropertyVisitor v) throws java.lang.Exception
Accepts the given visitor.- Specified by:
accept
in interfacePropertyVisitorAcceptor
- Overrides:
accept
in classProperty
- Parameters:
v
- the PropertyVisitor.- Throws:
java.lang.Exception
-
getBoolean
public boolean getBoolean()
Returns value as boolean (primitive type).- Returns:
- value as primitive boolean. If value object is null, returns false.
-
getBooleanObject
public java.lang.Boolean getBooleanObject()
Returns value asBoolean
object.- Returns:
- value as
Boolean
object.
-
setValue
public void setValue(boolean value)
Sets value as primitive boolean type.- Parameters:
value
- the given new boolean value.
-
setValue
public void setValue(java.lang.Object value)
Sets boolean value from given Object. ses toString
-
getClassType
public java.lang.String getClassType()
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in classProperty
- Returns:
- PropertyID.BOOLEAN_PROPERTY
- See Also:
PropertyID.BOOLEAN_PROPERTY
-
isValueCompatible
protected boolean isValueCompatible(java.lang.Object value)
- Overrides:
isValueCompatible
in classProperty
- Returns:
- true if given object can be assigned as value to this property
-
clone
public BooleanProperty clone()
Description copied from class:Property
Clones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.
-
-