Package org.datanucleus.properties
Class PropertyStore
- java.lang.Object
-
- org.datanucleus.properties.PropertyStore
-
- Direct Known Subclasses:
AbstractStoreManager
,BasePropertyStore
,Configuration
public abstract class PropertyStore extends java.lang.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 java.util.Map<java.lang.String,java.lang.Object>
properties
Map of properties.
-
Constructor Summary
Constructors Constructor Description PropertyStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getBooleanObjectProperty(java.lang.String name)
Accessor for the specified property as a Boolean.boolean
getBooleanProperty(java.lang.String name)
Accessor for the specified property as a boolean.boolean
getBooleanProperty(java.lang.String name, boolean resultIfNotSet)
Accessor for the specified property as a boolean.FrequentlyAccessedProperties
getFrequentProperties()
int
getIntProperty(java.lang.String name)
Accessor for the specified property as an int.java.lang.Object
getProperty(java.lang.String name)
Method to get the value of a property from the store.java.lang.String
getStringProperty(java.lang.String name)
Accessor for the specified property as a String.boolean
hasProperty(java.lang.String name)
Accessor for whether a particular property is defined (but may be null).boolean
hasPropertyNotNull(java.lang.String name)
Accessor for whether a particular property is defined and has a non-null value.protected void
setPropertyInternal(java.lang.String name, java.lang.Object value)
Method to set a property in the store
-
-
-
Field Detail
-
properties
protected java.util.Map<java.lang.String,java.lang.Object> properties
Map of properties.
-
frequentProperties
protected FrequentlyAccessedProperties frequentProperties
-
-
Method Detail
-
setPropertyInternal
protected void setPropertyInternal(java.lang.String name, java.lang.Object value)
Method to set a property in the store- Parameters:
name
- Name of the propertyvalue
- Its value
-
getProperty
public java.lang.Object getProperty(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.Boolean getBooleanObjectProperty(java.lang.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 java.lang.String getStringProperty(java.lang.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
-
-