Package com.nomagic.magicdraw.properties
Class BooleanProperty
java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.BooleanProperty
- All Implemented Interfaces:
PropertyVisitorAcceptor
,Cloneable
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, TO, UNDEFINED, VALUE, VALUE_ANNOTATIONS
-
Constructor Summary
ConstructorDescriptionDefault constructor.BooleanProperty
(String id, boolean value) The boolean property constructor.BooleanProperty
(String id, Boolean value) The boolean property constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts the given visitor.clone()
Clones the property.boolean
Returns value as boolean (primitive type).Returns value asBoolean
object.Returns property class type.static String
getStringRepresentation
(Boolean value) Returns value's string representation.Returns value's string representation.protected boolean
isValueCompatible
(Object value) void
setValue
(boolean value) Sets value as primitive boolean type.void
Sets boolean value from given Object.Methods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addAnnotation, addPropertyChangeListener, addSource, addSources, areEqualByValue, areValuesEqual, checkFrozen, checkFrozen, createCellEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getAnnotation, getAnnotations, getDescription, getDescriptionID, getFirstElementFromSources, getGroup, getID, getIntroductoryVersion, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSortableValueStringRepresentation, getSourceAsElement, getSources, getSourcesAsStream, getUndefinedString, getUndefinedString, getValue, hashCode, isEditable, isUndefinedState, removeAnnotation, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setAnnotations, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
-
Constructor Details
-
BooleanProperty
public BooleanProperty()Default constructor. Value of the property will be false. ID will be empty string. -
BooleanProperty
The boolean property constructor.- Parameters:
id
- the ID of property.value
- the boolean value of the property.
-
BooleanProperty
The boolean property constructor.- Parameters:
id
- the ID of the property.value
- the boolean value of the property.
-
-
Method Details
-
getValueStringRepresentation
Returns value's string representation.- Overrides:
getValueStringRepresentation
in classProperty
- Returns:
- string "True", "False" or "?" if property does not have value.
-
getStringRepresentation
Returns value's string representation.- Parameters:
value
- The given value.- Returns:
- String representation.
-
accept
Accepts the given visitor.- Specified by:
accept
in interfacePropertyVisitorAcceptor
- Overrides:
accept
in classProperty
- Parameters:
v
- the PropertyVisitor.- Throws:
Exception
-
getBoolean
public boolean getBoolean()Returns value as boolean (primitive type).- Returns:
- value as primitive boolean. If value object is null, returns false.
-
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
Sets boolean value from given Object. ses toString -
getClassType
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in classProperty
- Returns:
- PropertyID.BOOLEAN_PROPERTY
- See Also:
-
isValueCompatible
- Overrides:
isValueCompatible
in classProperty
- Returns:
- true if given object can be assigned as value to this property
-
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.
-