Package com.nomagic.magicdraw.properties
Class PropertyPool
java.lang.Object
com.nomagic.magicdraw.properties.PropertyPool
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!!!
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleanPropertyReturns shared instance of boolean property with the same id and value as given property.static BooleanPropertygetBooleanProperty(String id, boolean value) Returns shared instance of boolean property with the given id and value.static BooleanPropertygetBooleanProperty(String id, boolean value, String group) Returns shared instance of boolean property with the given id and value.static ChoicePropertyReturns shared instance of choice property with the same id and value as given property.static ChoicePropertygetChoiceProperty(String id, Object value, List possibleValues) Returns shared instance of choice property with the given id, value and possible values for selectionstatic ChoicePropertygetChoiceProperty(String id, Object value, List possibleValues, String group) Returns shared instance of choice property with the given id, group, value and possible values for selectionstatic ColorPropertyReturns shared instance of color property with the same id and value as given property.static ColorPropertygetColorProperty(String id, Color value) Returns shared instance of color property with the given id and value.static ColorPropertygetColorProperty(String id, Color value, String group) Returns shared instance of color property with the given id and value.static FontPropertyReturns shared instance of font property with the same id and value as given property.static FontPropertygetFontProperty(String id, Font value) Returns shared instance of font property with the given id and value.static FontPropertygetFontProperty(String id, Font value, String group) Returns shared instance of font property with the given id and value.static PropertygetProperty(Property property) Returns shared instance of given property.
-
Constructor Details
-
PropertyPool
public PropertyPool()
-
-
Method Details
-
getBooleanProperty
Returns shared instance of boolean property with the same id and value as given property.- Parameters:
p- the given property.- Returns:
- shared instance.
-
getBooleanProperty
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(String id, boolean value, @CheckForNull 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
Returns shared instance of color property with the same id and value as given property.- Parameters:
p- the given property.- Returns:
- shared instance.
-
getColorProperty
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
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
Returns shared instance of font property with the same id and value as given property.- Parameters:
p- the given property.- Returns:
- shared instance.
-
getFontProperty
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
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
Returns shared instance of choice property with the same id and value as given property.- Parameters:
p- the given property.- Returns:
- shared instance.
-
getChoiceProperty
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(String id, @CheckForNull Object value, List possibleValues, @CheckForNull 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
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
-