Class PropertyPool


  • @OpenApiAll
    public class PropertyPool
    extends java.lang.Object
    This is a pool of the properties. Use this pool if you do not want to create a lot of instance of properties with the same ID and value.

    Be careful with changing the value of property taken from this pool. Property is mutable object!!!

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static com.nomagic.magicdraw.properties.propertypool.BooleanPropertyPool BOOLEAN_PROPERTY_POOL  
      private static com.nomagic.magicdraw.properties.propertypool.ChoicePropertyPool CHOICE_PROPERTY_POOL  
      private static com.nomagic.magicdraw.properties.propertypool.ColorPropertyPool COLOR_PROPERTY_POOL  
      private static com.nomagic.magicdraw.properties.propertypool.FontPropertyPool FONT_PROPERTY_POOL  
    • Constructor Summary

      Constructors 
      Constructor Description
      PropertyPool()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static BooleanProperty getBooleanProperty​(BooleanProperty p)
      Returns shared instance of boolean property with the same id and value as given property.
      static BooleanProperty getBooleanProperty​(java.lang.String id, boolean value)
      Returns shared instance of boolean property with the given id and value.
      static BooleanProperty getBooleanProperty​(java.lang.String id, boolean value, java.lang.String group)
      Returns shared instance of boolean property with the given id and value.
      static ChoiceProperty getChoiceProperty​(ChoiceProperty p)
      Returns shared instance of choice property with the same id and value as given property.
      static ChoiceProperty getChoiceProperty​(java.lang.String id, java.lang.Object value, java.util.List possibleValues)
      Returns shared instance of choice property with the given id, value and possible values for selection
      static ChoiceProperty getChoiceProperty​(java.lang.String id, java.lang.Object value, java.util.List possibleValues, java.lang.String group)
      Returns shared instance of choice property with the given id, group, value and possible values for selection
      static ColorProperty getColorProperty​(ColorProperty p)
      Returns shared instance of color property with the same id and value as given property.
      static ColorProperty getColorProperty​(java.lang.String id, java.awt.Color value)
      Returns shared instance of color property with the given id and value.
      static ColorProperty getColorProperty​(java.lang.String id, java.awt.Color value, java.lang.String group)
      Returns shared instance of color property with the given id and value.
      static FontProperty getFontProperty​(FontProperty p)
      Returns shared instance of font property with the same id and value as given property.
      static FontProperty getFontProperty​(java.lang.String id, java.awt.Font value)
      Returns shared instance of font property with the given id and value.
      static FontProperty getFontProperty​(java.lang.String id, java.awt.Font value, java.lang.String group)
      Returns shared instance of font property with the given id and value.
      static Property getProperty​(Property property)
      Returns shared instance of given property.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BOOLEAN_PROPERTY_POOL

        private static final com.nomagic.magicdraw.properties.propertypool.BooleanPropertyPool BOOLEAN_PROPERTY_POOL
      • COLOR_PROPERTY_POOL

        private static final com.nomagic.magicdraw.properties.propertypool.ColorPropertyPool COLOR_PROPERTY_POOL
      • FONT_PROPERTY_POOL

        private static final com.nomagic.magicdraw.properties.propertypool.FontPropertyPool FONT_PROPERTY_POOL
      • CHOICE_PROPERTY_POOL

        private static final com.nomagic.magicdraw.properties.propertypool.ChoicePropertyPool CHOICE_PROPERTY_POOL
    • Constructor Detail

      • PropertyPool

        public PropertyPool()
    • Method Detail

      • getBooleanProperty

        public static BooleanProperty getBooleanProperty​(BooleanProperty p)
        Returns shared instance of boolean property with the same id and value as given property.
        Parameters:
        p - the given property.
        Returns:
        shared instance.
      • getBooleanProperty

        public static BooleanProperty getBooleanProperty​(java.lang.String id,
                                                         boolean value)
        Returns shared instance of boolean property with the given id and value.
        Parameters:
        id - the property id.
        value - the given value of the property.
        Returns:
        shared instance.
      • getBooleanProperty

        public static BooleanProperty getBooleanProperty​(java.lang.String id,
                                                         boolean value,
                                                         @CheckForNull
                                                         java.lang.String group)
        Returns shared instance of boolean property with the given id and value.
        Parameters:
        id - the property id.
        value - the given value of the property.
        group - property group
        Returns:
        shared instance
      • getColorProperty

        public static ColorProperty getColorProperty​(ColorProperty p)
        Returns shared instance of color property with the same id and value as given property.
        Parameters:
        p - the given property.
        Returns:
        shared instance.
      • getColorProperty

        public static ColorProperty getColorProperty​(java.lang.String id,
                                                     java.awt.Color value)
        Returns shared instance of color property with the given id and value.
        Parameters:
        id - the property id.
        value - the given value of the property.
        Returns:
        shared instance.
      • getColorProperty

        public static ColorProperty getColorProperty​(java.lang.String id,
                                                     java.awt.Color value,
                                                     @CheckForNull
                                                     java.lang.String group)
        Returns shared instance of color property with the given id and value.
        Parameters:
        id - the property id.
        value - the given value of the property.
        group - property group
        Returns:
        shared instance
      • getFontProperty

        public static FontProperty getFontProperty​(FontProperty p)
        Returns shared instance of font property with the same id and value as given property.
        Parameters:
        p - the given property.
        Returns:
        shared instance.
      • getFontProperty

        public static FontProperty getFontProperty​(java.lang.String id,
                                                   java.awt.Font value)
        Returns shared instance of font property with the given id and value.
        Parameters:
        id - the property id.
        value - the given value of the property.
        Returns:
        shared instance.
      • getFontProperty

        public static FontProperty getFontProperty​(java.lang.String id,
                                                   java.awt.Font value,
                                                   @CheckForNull
                                                   java.lang.String group)
        Returns shared instance of font property with the given id and value.
        Parameters:
        id - the property id.
        value - the given value of the property.
        group - property group
        Returns:
        shared instance
      • getChoiceProperty

        public static ChoiceProperty getChoiceProperty​(ChoiceProperty p)
        Returns shared instance of choice property with the same id and value as given property.
        Parameters:
        p - the given property.
        Returns:
        shared instance.
      • getChoiceProperty

        public static ChoiceProperty getChoiceProperty​(java.lang.String id,
                                                       java.lang.Object value,
                                                       java.util.List possibleValues)
        Returns shared instance of choice property with the given id, value and possible values for selection
        Parameters:
        id - the property id.
        value - the given value of the property.
        Returns:
        shared instance.
      • getChoiceProperty

        public static ChoiceProperty getChoiceProperty​(java.lang.String id,
                                                       @CheckForNull
                                                       java.lang.Object value,
                                                       java.util.List possibleValues,
                                                       @CheckForNull
                                                       java.lang.String group)
        Returns shared instance of choice property with the given id, group, value and possible values for selection
        Parameters:
        id - the property id.
        value - the given value of the property.
        group - property group
        Returns:
        shared instance
      • getProperty

        public static Property getProperty​(Property property)
        Returns shared instance of given property. If this pool can not create shared instance, return given property.
        Parameters:
        property - the given property.
        Returns:
        cached property