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
-
Method Summary
Modifier and TypeMethodDescriptionstatic BooleanProperty
Returns shared instance of boolean property with the same id and value as given property.static BooleanProperty
getBooleanProperty
(String id, boolean value) Returns shared instance of boolean property with the given id and value.static BooleanProperty
getBooleanProperty
(String id, boolean value, String group) Returns shared instance of boolean property with the given id and value.static ChoiceProperty
Returns shared instance of choice property with the same id and value as given property.static ChoiceProperty
getChoiceProperty
(String id, Object value, List possibleValues) Returns shared instance of choice property with the given id, value and possible values for selectionstatic ChoiceProperty
getChoiceProperty
(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 ColorProperty
Returns shared instance of color property with the same id and value as given property.static ColorProperty
getColorProperty
(String id, Color value) Returns shared instance of color property with the given id and value.static ColorProperty
getColorProperty
(String id, Color value, String group) Returns shared instance of color property with the given id and value.static FontProperty
Returns shared instance of font property with the same id and value as given property.static FontProperty
getFontProperty
(String id, Font value) Returns shared instance of font property with the given id and value.static FontProperty
getFontProperty
(String id, Font value, 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.
-
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
-