public abstract class PropertyContainer
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object>
|
getProperties
()
Gets all of the properties belonging to this container.
|
java.lang.Object
|
getProperty
(java.lang.String propertyName)
Gets the property with the specified name.
|
boolean
|
hasProperty
(java.lang.String propertyName)
Returns true if a property has been set.
|
boolean
|
isUnindexedProperty
(java.lang.String propertyName)
Returns true if
propertyName
has a value that will not be
indexed.
|
void
|
removeProperty
(java.lang.String propertyName)
Removes any property with the specified name.
|
void
|
setPropertiesFrom
(
PropertyContainer
src)
A convenience method that populates properties from those in the given
container.
|
void
|
setProperty
(java.lang.String propertyName,
java.lang.Object value)
Sets the property named,
propertyName
, to
value
.
|
void
|
setUnindexedProperty
(java.lang.String propertyName,
java.lang.Object value)
Like
#setProperty
, but doesn't index the property in the built-in
single property indexes.
|
public java.lang.Object getProperty(java.lang.String propertyName)
setProperty(java.lang.String, java.lang.Object)
.
propertyName
.
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Map
of properties.
public boolean hasProperty(java.lang.String propertyName)
null
.
propertyName
exists.
public void removeProperty(java.lang.String propertyName)
java.lang.NullPointerException
- If
propertyName
is null.
public void setProperty(java.lang.String propertyName, java.lang.Object value)
propertyName
, to
value
.
As the value is stored in the datastore, it is converted to the
datastore's native type. This may include widening, such as
converting a
Short
to a
Long
.
If value is a
Collection
, the values will be stored in the
datastore with the collection's iteration order with one caveat: all
indexed values will come before all unindexed values (this can occur if the
Collection
contains both values that are normally indexed like
strings, and values that are never indexed like
Blob
,
Text
and
EmbeddedEntity
).
Overrides any existing value for this property, whether indexed or unindexed.
Note that
Blob
,
Text
and
EmbeddedEntity
property
values are never indexed by the built-in single property indexes. To store
other types without being indexed, use
setUnindexedProperty(java.lang.String, java.lang.Object)
.
value
- may be one of the supported datatypes or a heterogeneous
Collection
of one of the supported datatypes.
java.lang.IllegalArgumentException
- If the value is not of a type that
the data store supports.
setUnindexedProperty(java.lang.String, java.lang.Object)
public void setUnindexedProperty(java.lang.String propertyName, java.lang.Object value)
#setProperty
, but doesn't index the property in the built-in
single property indexes.
value
- may be one of the supported datatypes, or a heterogeneous
Collection
of one of the supported datatypes.
Overrides any existing value for this property, whether indexed or unindexed.
java.lang.IllegalArgumentException
- If the value is not of a type that
the data store supports.
setProperty(java.lang.String, java.lang.Object)
public boolean isUnindexedProperty(java.lang.String propertyName)
propertyName
has a value that will not be
indexed. This includes
Text
,
Blob
, and any property
added using
setUnindexedProperty(java.lang.String, java.lang.Object)
.
public void setPropertiesFrom(PropertyContainer src)
This method transfers information about unindexed properties and clones any mutable values.
src
- The container from which we will populate ourself.