Package | impression.persistence |
Class | public class PersistedPropertiesCollection |
Inheritance | PersistedPropertiesCollection ![]() |
Subclasses | ChildElement |
The PPC object provides methods to store and retrieve both typed and untyped values. The methods for retrieving data allow the user to specify a default value that is returned if no data exists for the specified property name.
Property | Defined By | ||
---|---|---|---|
length : int [read-only]
The number of items in the collection. | PersistedPropertiesCollection | ||
name : String [read-only]
The name of the collection. | PersistedPropertiesCollection | ||
useIntType : Boolean = false [static]
Specifies how PersistedPropertyCollection objects will store numeric data loaded from an XML object. | PersistedPropertiesCollection |
Method | Defined By | ||
---|---|---|---|
PersistedPropertiesCollection(name:String = null)
Creates a new instance of the PersistedPropertiesCollection class. | PersistedPropertiesCollection | ||
clear():void
Removes all items from the collection. | PersistedPropertiesCollection | ||
clone():*
Returns a copy of the object. | PersistedPropertiesCollection | ||
contains(propertyName:String):Boolean
Returns a value indicating whether or not the property specified by propertyName exists in the collection. | PersistedPropertiesCollection | ||
copyFrom(source:PersistedPropertiesCollection, overwriteExisting:Boolean):void
Copies properties from the source object into the collection. | PersistedPropertiesCollection | ||
fromXML(source:XML):PersistedPropertiesCollection [static]
Returns a new instance of the PersistedPropertiesCollection class based on the data contained in the XML object. | PersistedPropertiesCollection | ||
Returns an AssetData value. | PersistedPropertiesCollection | ||
getBoolean(propertyName:String, defaultValue:Boolean):Boolean
Returns a Boolean value. | PersistedPropertiesCollection | ||
Returns a ChildElementCollection value. | PersistedPropertiesCollection | ||
Returns a ColorData value. | PersistedPropertiesCollection | ||
Returns a FontData value. | PersistedPropertiesCollection | ||
getInt(propertyName:String, defaultValue:int):int
Returns an int value. | PersistedPropertiesCollection | ||
Returns a LocationData value. | PersistedPropertiesCollection | ||
getNumber(propertyName:String, defaultValue:Number):Number
Returns a Number value. | PersistedPropertiesCollection | ||
getPPC(propertyName:String, defaultValue:PersistedPropertiesCollection):PersistedPropertiesCollection
Returns a PersistedPropertiesCollection value. | PersistedPropertiesCollection | ||
getRectangle(propertyName:String, defaultValue:Rectangle):Rectangle
Returns a Rectangle value. | PersistedPropertiesCollection | ||
getString(propertyName:String, defaultValue:String):String
Returns a String value. | PersistedPropertiesCollection | ||
getUInt(propertyName:String, defaultValue:uint):uint
Returns a uint value. | PersistedPropertiesCollection | ||
getValue(propertyName:String, defaultValue:*, requireTypeMatching:Boolean = true, requiredType:Class = null):*
Returns a value. | PersistedPropertiesCollection | ||
remove(propertyName:String):void
Removes an item from the collection. | PersistedPropertiesCollection | ||
removeIn(source:PersistedPropertiesCollection):void
Removes all properties from this instance where the property name is present in source. | PersistedPropertiesCollection | ||
Stores an AssetData value. | PersistedPropertiesCollection | ||
setBoolean(propertyName:String, newValue:Boolean):void
Stores a Boolean value. | PersistedPropertiesCollection | ||
setCEC(propertyName:String, newValue:ChildElementCollection):void
Stores a ChildElementCollection value. | PersistedPropertiesCollection | ||
Stores a ColorData value. | PersistedPropertiesCollection | ||
Stores a FontData value. | PersistedPropertiesCollection | ||
setInt(propertyName:String, newValue:int):void
Stores an int value. | PersistedPropertiesCollection | ||
setLocation(propertyName:String, newValue:LocationData):void
Stores a LocationData value. | PersistedPropertiesCollection | ||
setNumber(propertyName:String, newValue:Number):void
Stores a Number value. | PersistedPropertiesCollection | ||
setPPC(propertyName:String, newValue:PersistedPropertiesCollection):void
Stores a PersistedPropertiesCollection value. | PersistedPropertiesCollection | ||
setRectangle(propertyName:String, newValue:Rectangle):void
Stores a Rectangle value. | PersistedPropertiesCollection | ||
setString(propertyName:String, newValue:String):void
Stores a String value. | PersistedPropertiesCollection | ||
setUInt(propertyName:String, newValue:uint):void
Stores a uint value. | PersistedPropertiesCollection | ||
setValue(propertyName:String, newValue:*):void
Stores a value. | PersistedPropertiesCollection | ||
toObject(cloneProperties:Boolean = true):Object
Returns an object containing a copy of all the items stored in the collection. | PersistedPropertiesCollection | ||
toString():String
Returns the string representation of the specified object. | PersistedPropertiesCollection | ||
toXML():XML
Returns an Impression-format XML object containing all the data from the object. | PersistedPropertiesCollection | ||
typesMatch(a:*, b:*, requiredType:Class = null):Boolean
Returns a Boolean value specifying whether or not an item is of a specific type. | PersistedPropertiesCollection |
length | property |
length:int
[read-only] The number of items in the collection.
public function get length():int
name | property |
name:String
[read-only] The name of the collection.
The default value is properties
.
public function get name():String
useIntType | property |
public static var useIntType:Boolean = false
Specifies how PersistedPropertyCollection objects will store numeric data loaded from an XML object.
If this property value is true
, property xml values with an int
type (that is, the
property xml is of the form <intProp name="[property name]" value="[value]" />
)
are stored as int
values. If this property value is false
these properties are stored
as number
values.
PersistedPropertiesCollection | () | Constructor |
public function PersistedPropertiesCollection(name:String = null)
Creates a new instance of the PersistedPropertiesCollection class.
If name
is null
, the default value will be used.
name:String (default = null ) — A String specifying the name of the PersistedPropertiesCollection.
|
See also
clear | () | method |
public function clear():void
Removes all items from the collection.
clone | () | method |
public function clone():*
Returns a copy of the object.
Objects that have a type-specific set[type]/get[type] method pair defined in this class
(for example, AssetData
objects) are copied by invoking their clone
method before
they are stored in the clone.
Other property values are assigned to the clone using the equals operator (=). Depending on the
object type, it may be either a copy of, or a reference to, the original object. Use caution when working with
objects stored using setValue
.
* — A copy of the object.
|
See also
contains | () | method |
public function contains(propertyName:String):Boolean
Returns a value indicating whether or not the property specified by propertyName
exists in the collection.
Parameters
propertyName:String — The name of the property to check for.
|
Boolean — A Boolean indicating whether or not the property exists in the collection.
|
copyFrom | () | method |
public function copyFrom(source:PersistedPropertiesCollection, overwriteExisting:Boolean):void
Copies properties from the source
object into the collection.
If overwriteExisting
is true
, properties in source
that already exist in the
collection will be overwritten. If overwriteExisting
is false
, only
properties exclusive to source
will be copied into the collection.
Parameters
source:PersistedPropertiesCollection — The object to copy property data from.
| |
overwriteExisting:Boolean — Indicates whether or not existing properties should be overwritten with values from source .
|
fromXML | () | method |
public static function fromXML(source:XML):PersistedPropertiesCollection
Returns a new instance of the PersistedPropertiesCollection class based on the data contained in the XML object.
If source
is null
, an empty PersistedPropertiesCollection object is returned.
If the source.name
property is not "ppc", an error is thrown.
This method iterates through the child elements of source
, creating new strongly typed
properties based on the values of the source
data. Any encoded values are decoded before being
stored in the returned object.
The XML format of a PersistedPropertiesCollection object is:
Where [persisted property value]
can be one of the following:
Parameters
source:XML — The object containing the data to use.
|
PersistedPropertiesCollection — A PersistedPropertiesCollection object containing the data from the source XML object.
|
ArgumentError — node is not a <ppc> element (ArgumentError).
|
See also
getAsset | () | method |
public function getAsset(propertyName:String, defaultValue:AssetData):AssetData
Returns an AssetData value.
If the property identified by propertyName
cannot be found in the collection, is not an AssetData value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the AssetData object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setAsset
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:AssetData — The default return value.
|
AssetData — The value identified by propertyName , or defaultValue .
|
See also
getBoolean | () | method |
public function getBoolean(propertyName:String, defaultValue:Boolean):Boolean
Returns a Boolean value.
If the property identified by propertyName
cannot be found in the collection, is not a Boolean value,
or an error occurs while accessing the property, this method returnds defaultValue
.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:Boolean — The default return value.
|
Boolean — The value identified by propertyName , or defaultValue .
|
getCEC | () | method |
public function getCEC(propertyName:String, defaultValue:ChildElementCollection):ChildElementCollection
Returns a ChildElementCollection value.
If the property identified by propertyName
cannot be found in the collection, is not a ChildElementCollection value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the ChildElementCollection object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setCEC
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:ChildElementCollection — The default return value.
|
ChildElementCollection — The value identified by propertyName , or defaultValue .
|
See also
getColor | () | method |
public function getColor(propertyName:String, defaultValue:ColorData):ColorData
Returns a ColorData value.
If the property identified by propertyName
cannot be found in the collection, is not a ColorData value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the ColorData object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setColor
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:ColorData — The default return value.
|
ColorData — The value identified by propertyName , or defaultValue .
|
See also
getFont | () | method |
public function getFont(propertyName:String, defaultValue:FontData):FontData
Returns a FontData value.
If the property identified by propertyName
cannot be found in the collection, is not a FontData value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the FontData object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setFont
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:FontData — The default return value.
|
FontData — The value identified by propertyName , or defaultValue .
|
See also
getInt | () | method |
public function getInt(propertyName:String, defaultValue:int):int
Returns an int value.
If the property identified by propertyName
cannot be found in the collection, is not an int value,
or an error occurs while accessing the property, this method returnds defaultValue
.
The getInt
method will return stored values rather than the default even if the value was
stored using the setUInt
or setNumber
methods, if the stored value can be cast to an int
.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:int — The default return value.
|
int — The value identified by propertyName , or defaultValue .
|
See also
getLocation | () | method |
public function getLocation(propertyName:String, defaultValue:LocationData):LocationData
Returns a LocationData value.
If the property identified by propertyName
cannot be found in the collection, is not a LocationData value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the LocationData object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setLocation
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:LocationData — The default return value.
|
LocationData — The value identified by propertyName , or defaultValue .
|
See also
getNumber | () | method |
public function getNumber(propertyName:String, defaultValue:Number):Number
Returns a Number value.
If the property identified by propertyName
cannot be found in the collection, is not a Number value,
or an error occurs while accessing the property, this method returnds defaultValue
.
The getNumber
method will return stored values rather than the default even if the value was
stored using the setInt
or setUInt
methods.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:Number — The default return value.
|
Number — The value identified by propertyName , or defaultValue .
|
See also
getPPC | () | method |
public function getPPC(propertyName:String, defaultValue:PersistedPropertiesCollection):PersistedPropertiesCollection
Returns a PersistedPropertiesCollection value.
If the property identified by propertyName
cannot be found in the collection, is not a PersistedPropertiesCollection value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the PersistedPropertiesCollection object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setPPC
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:PersistedPropertiesCollection — The default return value.
|
PersistedPropertiesCollection — The value identified by propertyName , or defaultValue .
|
See also
getRectangle | () | method |
public function getRectangle(propertyName:String, defaultValue:Rectangle):Rectangle
Returns a Rectangle value.
If the property identified by propertyName
cannot be found in the collection, is not a Rectangle value,
or an error occurs while accessing the property, this method returnds defaultValue
.
If you manipulate the properties of the Rectangle object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setRectangle
to ensure changes made to the object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:Rectangle — The default return value.
|
Rectangle — The value identified by propertyName , or defaultValue .
|
See also
getString | () | method |
public function getString(propertyName:String, defaultValue:String):String
Returns a String value.
If the property identified by propertyName
cannot be found in the collection, is not a String value,
or an error occurs while accessing the property, this method returnds defaultValue
.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:String — The default return value.
|
String — The value identified by propertyName , or defaultValue .
|
getUInt | () | method |
public function getUInt(propertyName:String, defaultValue:uint):uint
Returns a uint value.
If the property identified by propertyName
cannot be found in the collection, is not a uint value,
or an error occurs while accessing the property, this method returnds defaultValue
.
The getInt
method will return stored values rather than the default even if the value was
stored using the setInt
or setNumber
methods, if the stored value can be cast to an uint
.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:uint — The default return value.
|
uint — The value identified by propertyName , or defaultValue .
|
See also
getValue | () | method |
public function getValue(propertyName:String, defaultValue:*, requireTypeMatching:Boolean = true, requiredType:Class = null):*
Returns a value.
If a property identified by propertyName
cannot be found in the PersistedPropertiesCollection
, this method returns
defaultValue
. If an error occurs while accessing the property, this method returns defaultValue
.
This method does not enforce type safety; that is, if the property exists but does not match the type of defaultValue
,
this method returns the property value. This is in contrast to the other get[type] methods, which will return defaultValue
if the
PersistedPropertiesCollection
property value does not match the requested type. Use caution when using this method.
If you manipulate the properties of an object returned using this method, remember that the return value may not have come from
the collection. You may wish to use setValue
to ensure changes made to an object are properly stored in the collection.
Parameters
propertyName:String — The name of the property to return.
| |
defaultValue:* — A default return value for the propertyName .
| |
requireTypeMatching:Boolean (default = true ) — A Boolean specifying how to handle cases where the type of the property value stored does not match the the
type of the requiredType parameter. If this value is true , the defaultValue will be returned if the
stored value does not match the type of requiredType . If this value is false , the stored value will be returned
if it exists in the collection, regardless of its type.
| |
requiredType:Class (default = null ) — A Class specifying the type for the return value.
|
* — The stored value of propertyName , or defaultValue .
|
See also
remove | () | method |
public function remove(propertyName:String):void
Removes an item from the collection.
If propertyName
does not exist in the collection, invoking this method has no effect.
Parameters
propertyName:String — A String specifying the property to remove.
|
removeIn | () | method |
public function removeIn(source:PersistedPropertiesCollection):void
Removes all properties from this instance where the property name is present in source
.
Parameters
source:PersistedPropertiesCollection — The object containing the property names to remove from the collection.
|
setAsset | () | method |
public function setAsset(propertyName:String, newValue:AssetData):void
Stores an AssetData value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:AssetData — The value to store.
|
See also
setBoolean | () | method |
public function setBoolean(propertyName:String, newValue:Boolean):void
Stores a Boolean value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:Boolean — The value to store.
|
See also
setCEC | () | method |
public function setCEC(propertyName:String, newValue:ChildElementCollection):void
Stores a ChildElementCollection value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:ChildElementCollection — The value to store.
|
See also
setColor | () | method |
public function setColor(propertyName:String, newValue:ColorData):void
Stores a ColorData value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:ColorData — The value to store.
|
See also
setFont | () | method |
public function setFont(propertyName:String, newValue:FontData):void
Stores a FontData value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:FontData — The value to store.
|
See also
setInt | () | method |
public function setInt(propertyName:String, newValue:int):void
Stores an int value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:int — The value to store.
|
See also
setLocation | () | method |
public function setLocation(propertyName:String, newValue:LocationData):void
Stores a LocationData value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:LocationData — The value to store.
|
See also
setNumber | () | method |
public function setNumber(propertyName:String, newValue:Number):void
Stores a Number value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:Number — The value to store.
|
See also
setPPC | () | method |
public function setPPC(propertyName:String, newValue:PersistedPropertiesCollection):void
Stores a PersistedPropertiesCollection value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:PersistedPropertiesCollection — The value to store.
|
See also
setRectangle | () | method |
public function setRectangle(propertyName:String, newValue:Rectangle):void
Stores a Rectangle value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Note that this method stores a reference to, not a copy of, the original data.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:Rectangle — The value to store.
|
See also
setString | () | method |
public function setString(propertyName:String, newValue:String):void
Stores a String value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:String — The value to store.
|
See also
setUInt | () | method |
public function setUInt(propertyName:String, newValue:uint):void
Stores a uint value.
If a property already exists with propertyName
, newValue
replaces it, regardless of the original property type.
Parameters
propertyName:String — The name of the property to store.
| |
newValue:uint — The value to store.
|
See also
setValue | () | method |
public function setValue(propertyName:String, newValue:*):void
Stores a value.
If the collection already contains a property named propertyName
, the property is replaced by newValue
.
Parameters
propertyName:String — The name of the property to be added.
| |
newValue:* — The value to be stored.
|
toObject | () | method |
public function toObject(cloneProperties:Boolean = true):Object
Returns an object containing a copy of all the items stored in the collection.
Property values are stored as dynamic properties (indexed via the property name) within the object. Only valid non-null values are copied.
If the cloneProperties
parameter is true
, objects that have a
type-specific set[type]/get[type] method pair defined in this class (for example, AssetData
objects) are copied by invoking their clone
method before they are stored in the
return value.
Other property values are assigned to the object using the equals operator (=). Depending on the
object type, it may be either a copy of, or a reference to, the original object. Use caution when working with
objects stored using setValue
when cloneProperties
is true
.
Parameters
cloneProperties:Boolean (default = true ) — Specifies how object properties should be be added to the return value.
|
Object — An Object containing a copy of all items stored in the collection.
|
See also
toString | () | method |
public function toString():String
Returns the string representation of the specified object.
ReturnsString — The string representation of the specified object.
|
toXML | () | method |
public function toXML():XML
Returns an Impression-format XML object containing all the data from the object.
If a string property value has the less than character (<) in it, then the string is modified before being added to the XML object. Specifically:
&
.<
.>
.XML — An XML object containing all the data from the object.
|
See also
typesMatch | () | method |
public function typesMatch(a:*, b:*, requiredType:Class = null):Boolean
Returns a Boolean value specifying whether or not an item is of a specific type.
If either a
or b
is null
, this function returns true
. If an
error occurs during evaluation, this method returns false
. If requiredType
is null
,
a
is evaluated against b
by using the statement:
If requiredType
is not null
, a
is evaluated against b
by using
the statement:
Parameters
a:* — The item to evaluate.
| |
b:* — The item whose type a is to be evaluated against, if requiredType is null .
| |
requiredType:Class (default = null ) — An optional Class expression specifying the type to evaluate a against.
|
Boolean — A Boolean value specifying whether or not a is of the specified type.
|