Access keys

PropertyInfo

Kind of class: class
Inherits from: BasicClass
Implements:
Author: Simon Wacker
Classpath: org.as2lib.env.reflect.PropertyInfo
File last modified: Monday, 25 July 2005, 15:24:56
PropertyInfo represents a property.

The term property means only properties added via Object.addProperty
or the ones added with the get and set keywords, that are implicit
getters and setters, not variables.

PropertyInfo instances for specific properties can be obtained using
the methods ClassInfo.getProperties or ClassInfo.getProperty.
That means you first have to get a class info for the class that declares or
inherits the property. You can therefor use the ClassInfo.forObject,
ClassInfo.forClass, ClassInfo.forInstance and ClassInfo.forName
methods.

When you have obtained the property info you can use it to get information
about the property.

trace("Property name: " + propertyInfo.getName());
trace("Declaring type: " + propertyInfo.getDeclaringType().getFullName());
trace("Is Static?: " + propertyInfo.isStatic());
trace("Is Writable?: " + propertyInfo.isWritable());
trace("Is Readable?: " + propertyInfo.isReadable());

Summary

Constructor

PropertyInfo

function PropertyInfo (
name:String, declaringType:TypeInfo, staticFlag:Boolean, setter:Function, getter:Function)
Constructs a new PropertyInfo instance.

All arguments are allowed to be null. But keep in mind that not all
methods will function properly if one is.

If arguments setter or getter are not specified they will be
resolved at run-time everytime asked for. Making use of this functionality you
will always get the up-to-date setter or getter.

Parameters:
name :
the name of the property
declaringType:
the type declaring the property
staticFlag :
determines whether the property is static
setter :
(optional) the setter method of the property
getter :
(optional) the getter method of the property

Class methods

getStringifier

static function getStringifier (
Void) : Stringifier
Returns the stringifier used to stringify property infos.

If no custom stringifier has been set via the setStringifier method,
an instance of the default org.as2lib.env.reflect.stringifier.PropertyInfoStringifier class is returned.

Returns:
the stringifier that stringifies property infos

setStringifier

static function setStringifier (
propertyInfoStringifier:PropertyInfoStringifier) : Void
Sets the stringifier used to stringify property infos.

If propertyInfoStringifier is null or undefined the
getStringifier method will return the default stringifier.

Parameters:
propertyInfoStringifier:
the stringifier that stringifies property infos

Instance methods

getDeclaringType

function getDeclaringType (
Void) : TypeInfo
Returns the type that declares this property.

At this time interfaces are not allowed to declare properties. The declaring
type is thus allways an instance of type ClassInfo, a class.

Returns:
the type that declares this property

getFullName

function getFullName (
Void) : String
Returns the full name of this property.

The full name is the fully qualified name of the declaring type plus the name
of this property.

Returns:
the full name of this property

getGetter

function getGetter (
Void) : MethodInfo
Returns the getter method of this property.

The getter method of a property takes no arguments, but returns the value of
the property. You can invoke it the same as every other method.

The name of this getter method is the prefix '__get__' plus the name of this
property.

Property getter methods are also known under the name implicit getters.

Returns:
the getter method of the property

getName

function getName (
Void) : String
Returns the name of this property.

If you want the getter or setter methods' name you must use the getName
method of the getGetter or getSetter method respectively. The
name of this getter or setter method is the prefix '__get__' or '__set__' plus
the name of this property.

Returns:
the name of this property
Specified by:

getSetter

function getSetter (
Void) : MethodInfo
Returns the setter method of this property.

The setter method of a property takes one argument, that is the new value that
shall be assigned to the property. You can invoke it the same as every other method.

The name of this setter method is the prefix '__set__' plus the name of this
property.

Property setter methods are also known under the name implicit setters.

Returns:
the setter method of this property

isReadable

function isReadable (
Void) : Boolean
Returns whether this property is readable.

This property is readable when its getter is not null.

Returns:
true when this property is readable else false

isStatic

function isStatic (
Void) : Boolean
Returns whether this property is static or not.

Static properties are properties per type.

Non-Static properties are properties per instance.

Returns:
true if this property is static else false

isWritable

function isWritable (
Void) : Boolean
Returns whether this property is writable.

This property is writable when its setter is not null.

Returns:
true if this property is writable else false

snapshot

function snapshot (
Void) : PropertyInfo
Returns a property info that reflects the current state of this property info.
Returns:
a snapshot of this property info

toString

function toString (
) : String
Returns the string representation of this property.

The string representation is obtained via the stringifier returned by the
static getStringifier method.

Returns:
the string representation of this property