Class BooleanProperty

java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.BooleanProperty
All Implemented Interfaces:
PropertyVisitorAcceptor, Cloneable

@OpenApiAll public class BooleanProperty extends Property
The property for storing and editing boolean value.
  • Constructor Details

    • BooleanProperty

      public BooleanProperty()
      Default constructor. Value of the property will be false. ID will be empty string.
    • BooleanProperty

      public BooleanProperty(String id, @CheckForNull Boolean value)
      The boolean property constructor.
      Parameters:
      id - the ID of property.
      value - the boolean value of the property.
    • BooleanProperty

      public BooleanProperty(String id, boolean value)
      The boolean property constructor.
      Parameters:
      id - the ID of the property.
      value - the boolean value of the property.
  • Method Details

    • getValueStringRepresentation

      public String getValueStringRepresentation()
      Returns value's string representation.
      Overrides:
      getValueStringRepresentation in class Property
      Returns:
      string "True", "False" or "?" if property does not have value.
    • getStringRepresentation

      public static String getStringRepresentation(@CheckForNull Boolean value)
      Returns value's string representation.
      Parameters:
      value - The given value.
      Returns:
      String representation.
    • accept

      public void accept(PropertyVisitor v) throws Exception
      Accepts the given visitor.
      Specified by:
      accept in interface PropertyVisitorAcceptor
      Overrides:
      accept in class Property
      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

      public Boolean getBooleanObject()
      Returns value as Boolean 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(Object value)
      Sets boolean value from given Object. ses toString
      Overrides:
      setValue in class Property
      Parameters:
      value - the given new boolean value.
    • getClassType

      public String getClassType()
      Returns property class type.
      Specified by:
      getClassType in interface PropertyVisitorAcceptor
      Overrides:
      getClassType in class Property
      Returns:
      PropertyID.BOOLEAN_PROPERTY
      See Also:
    • isValueCompatible

      protected boolean isValueCompatible(Object value)
      Overrides:
      isValueCompatible in class Property
      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.
      Overrides:
      clone in class Property
      Returns:
      the cloned property.