TypeMemberInfo
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());
public 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.
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 |
static public function getStringifier(Void):StringifierReturns the stringifier used to stringify property infos.
If no custom stringifier has been set via the setStringifier method, an instance of the default PropertyInfoStringifier class is returned.
the stringifier that stringifies property infos
static public function setStringifier(propertyInfoStringifier:PropertyInfoStringifier):VoidSets the stringifier used to stringify property infos.
If propertyInfoStringifier is null or undefined the
getStringifier method will return the default stringifier.
propertyInfoStringifier | the stringifier that stringifies property infos |
public function getName(Void):StringReturns 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.
the name of this property
public function getFullName(Void):StringReturns the full name of this property.
The full name is the fully qualified name of the declaring type plus the name of this property.
the full name of this property
public function getSetter(Void):MethodInfoReturns 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.
the setter method of this property
public function getGetter(Void):MethodInfoReturns 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.
the getter method of the property
public function getDeclaringType(Void):TypeInfoReturns 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.
the type that declares this property
public function isWritable(Void):BooleanReturns whether this property is writable.
This property is writable when its setter is not null.
true if this property is writable else false
public function isReadable(Void):BooleanReturns whether this property is readable.
This property is readable when its getter is not null.
true when this property is readable else false
public function isStatic(Void):BooleanReturns whether this property is static or not.
Static properties are properties per type.
Non-Static properties are properties per instance.
true if this property is static else false
public function snapshot(Void):PropertyInfoReturns a property info that reflects the current state of this property info.
a snapshot of this property info
public function toString():StringReturns the string representation of this property.
The string representation is obtained via the stringifier returned by the static getStringifier method.
the string representation of this property
toString() in org.as2lib.core.BasicInterface