Package org.datanucleus.properties
Class PropertyStore
- java.lang.Object
-
- org.datanucleus.properties.PropertyStore
-
- Direct Known Subclasses:
AbstractStoreManager
,BasePropertyStore
,Configuration
public abstract class PropertyStore extends Object
Representation of a store of properties. The properties can be for persistence, or for the datastore, or whatever. This class provides convenience type accessors to the properties. Properties are always stored in lowercase.
-
-
Field Summary
Fields Modifier and Type Field Description protected FrequentlyAccessedProperties
frequentProperties
protected Map<String,Object>
properties
Map of properties.
-
Constructor Summary
Constructors Constructor Description PropertyStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
getBooleanObjectProperty(String name)
Accessor for the specified property as a Boolean.boolean
getBooleanProperty(String name)
Accessor for the specified property as a boolean.boolean
getBooleanProperty(String name, boolean resultIfNotSet)
Accessor for the specified property as a boolean.FrequentlyAccessedProperties
getFrequentProperties()
int
getIntProperty(String name)
Accessor for the specified property as an int.Object
getProperty(String name)
Method to get the value of a property from the store.String
getStringProperty(String name)
Accessor for the specified property as a String.boolean
hasProperty(String name)
Accessor for whether a particular property is defined (but may be null).boolean
hasPropertyNotNull(String name)
Accessor for whether a particular property is defined and has a non-null value.protected void
setPropertyInternal(String name, Object value)
Method to set a property in the store
-
-
-
Field Detail
-
frequentProperties
protected FrequentlyAccessedProperties frequentProperties
-
-
Method Detail
-
setPropertyInternal
protected void setPropertyInternal(String name, Object value)
Method to set a property in the store- Parameters:
name
- Name of the propertyvalue
- Its value
-
getProperty
public Object getProperty(String name)
Method to get the value of a property from the store.- Parameters:
name
- Name of the property- Returns:
- Its value (or null)
-
hasProperty
public boolean hasProperty(String name)
Accessor for whether a particular property is defined (but may be null).- Parameters:
name
- Property name- Returns:
- Whether the property is defined
-
hasPropertyNotNull
public boolean hasPropertyNotNull(String name)
Accessor for whether a particular property is defined and has a non-null value.- Parameters:
name
- Property name- Returns:
- Whether the property is defined
-
getIntProperty
public int getIntProperty(String name)
Accessor for the specified property as an int. If the specified property isn't found returns 0.- Parameters:
name
- Name of the property- Returns:
- Int value for the property
- Throws:
PropertyTypeInvalidException
- thrown when the property is not available as this type
-
getBooleanProperty
public boolean getBooleanProperty(String name)
Accessor for the specified property as a boolean. If the specified property isn't found returns false.- Parameters:
name
- Name of the property- Returns:
- Boolean value for the property
- Throws:
PropertyTypeInvalidException
- thrown when the property is not available as this type
-
getBooleanProperty
public boolean getBooleanProperty(String name, boolean resultIfNotSet)
Accessor for the specified property as a boolean.- Parameters:
name
- Name of the propertyresultIfNotSet
- The value to return if no value for the specified property is found.- Returns:
- Boolean value for the property
- Throws:
PropertyTypeInvalidException
- thrown when the property is not available as this type
-
getBooleanObjectProperty
public Boolean getBooleanObjectProperty(String name)
Accessor for the specified property as a Boolean. If the specified property isn't found returns false.- Parameters:
name
- Name of the property- Returns:
- Boolean value for the property (or null if not present)
- Throws:
PropertyTypeInvalidException
- thrown when the property is not available as this type
-
getStringProperty
public String getStringProperty(String name)
Accessor for the specified property as a String. If the specified property isn't found returns null.- Parameters:
name
- Name of the property- Returns:
- String value for the property
- Throws:
PropertyTypeInvalidException
- thrown when the property is not available as this type
-
getFrequentProperties
public FrequentlyAccessedProperties getFrequentProperties()
- Returns:
- properties, which are stored in field for faster access
-
-