|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dynalang.mop.beans.BeanMetaobjectProtocol<T>
org.dynalang.mop.beans.ArrayMetaobjectProtocol<T>
T
- the class of the arraypublic class ArrayMetaobjectProtocol<T>
Adds access to array elements by numeric index as well as the "length"
read-only property to BeanMetaobjectProtocol
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.dynalang.mop.BaseMetaobjectProtocol |
---|
BaseMetaobjectProtocol.Result |
Constructor Summary | |
---|---|
ArrayMetaobjectProtocol(java.lang.Class<T> clazz,
boolean methodsEnumerable)
Constructs a new metaobject protocol for objects of a certain array class. |
Method Summary | |
---|---|
java.lang.Object |
get(java.lang.Object target,
long propertyId)
Behaves as CallProtocol.get(Object, Object) with an
integer property ID. |
java.lang.Object |
get(java.lang.Object target,
java.lang.Object propertyId)
Retrieves the property value from the target object. |
java.lang.Boolean |
has(java.lang.Object target,
long propertyId)
Behaves as BaseMetaobjectProtocol.has(Object, Object) with an
integer property ID. |
java.lang.Boolean |
has(java.lang.Object target,
java.lang.Object propertyId)
Tells whether the target object has a particular property. |
java.util.Iterator<java.lang.Object> |
propertyIds(java.lang.Object target)
Returns an iterator over the property IDs in the target object this MOP knows about (and chooses to expose - not all properties must be exposed; hidden properties are allowed). |
BaseMetaobjectProtocol.Result |
put(java.lang.Object target,
long propertyId,
java.lang.Object value,
CallProtocol callProtocol)
Behaves as BaseMetaobjectProtocol.put(Object, Object, Object,CallProtocol)
with an integer property ID. |
BaseMetaobjectProtocol.Result |
put(java.lang.Object target,
java.lang.Object propertyId,
java.lang.Object value,
CallProtocol callProtocol)
Associates a value with a property in the target object. |
Methods inherited from class org.dynalang.mop.beans.BeanMetaobjectProtocol |
---|
call, call, call, call, callStatic, delete, delete, newInstance, properties, representAs |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayMetaobjectProtocol(java.lang.Class<T> clazz, boolean methodsEnumerable) throws java.beans.IntrospectionException
clazz
- the class to construct a metaobject protocol formethodsEnumerable
- if true, methods are enumerable through the
BeanMetaobjectProtocol.properties(Object)
and propertyIds(Object)
.
java.lang.IllegalArgumentException
- if the passed class is not an array
class.
java.beans.IntrospectionException
Method Detail |
---|
public java.lang.Object get(java.lang.Object target, java.lang.Object propertyId)
CallProtocol
get
in interface CallProtocol
get
in class BeanMetaobjectProtocol<T>
target
- the target objectpropertyId
- the ID of the property. Usually a String or an
Integer, but other property ID types can also be supported.
BaseMetaobjectProtocol.Result.doesNotExist
. If the protocol decides that
the property exists, but is not readable, it will return
BaseMetaobjectProtocol.Result.notReadable
. If the protocol can not make
an authoritative decision, it will return BaseMetaobjectProtocol.Result.noAuthority
.public java.lang.Object get(java.lang.Object target, long propertyId)
MetaobjectProtocol
CallProtocol.get(Object, Object)
with an
integer property ID.
get
in interface MetaobjectProtocol
get
in class BeanMetaobjectProtocol<T>
target
- the target objectpropertyId
- the ID of the property.
CallProtocol.get(Object, Object)
.public java.lang.Boolean has(java.lang.Object target, java.lang.Object propertyId)
BaseMetaobjectProtocol
has
in interface BaseMetaobjectProtocol
has
in class BeanMetaobjectProtocol<T>
target
- the target objectpropertyId
- the ID of the property. Usually a String or an
Integer, but other property ID types can also be supported.
Boolean.TRUE
or Boolean.FALSE
if the protocol
can authoritatively decide whether the target has or has not the
property, or null if it does not have the authority to decide.public java.lang.Boolean has(java.lang.Object target, long propertyId)
MetaobjectProtocol
BaseMetaobjectProtocol.has(Object, Object)
with an
integer property ID.
has
in interface MetaobjectProtocol
has
in class BeanMetaobjectProtocol<T>
target
- the target objectpropertyId
- the ID of the property.
BaseMetaobjectProtocol.has(Object, Object)
.public java.util.Iterator<java.lang.Object> propertyIds(java.lang.Object target)
MetaobjectProtocol
propertyIds
in interface MetaobjectProtocol
propertyIds
in class BeanMetaobjectProtocol<T>
target
- the target object
public BaseMetaobjectProtocol.Result put(java.lang.Object target, java.lang.Object propertyId, java.lang.Object value, CallProtocol callProtocol)
BaseMetaobjectProtocol
put
in interface BaseMetaobjectProtocol
put
in class BeanMetaobjectProtocol<T>
target
- the target objectpropertyId
- the ID of the property. Usually a String or an
Integer, but other property ID types can also be supported.value
- the new value for the propertycallProtocol
- a marshaller that is used to convert the value in
case the property can only accept values of certain types, and the
metaobject protocol allows automatic coercing to those types.
BaseMetaobjectProtocol.Result.doesNotExist
. If the protocol
authoritatively decides that the property is read-only, it will return
BaseMetaobjectProtocol.Result.notWritable
. If the property has a limitation on types
it can take as values, and the supplied marshaller is not able to
provide a suitable representation, then the value of the property is not
changed, and BaseMetaobjectProtocol.Result.noRepresentation
is returned. Finally, if
the protocol doesn't have the authority to put the new property value,
it will leave the property value unchanged, and return
BaseMetaobjectProtocol.Result.noAuthority
. If the operation succeeds,
BaseMetaobjectProtocol.Result.ok
is returned.public BaseMetaobjectProtocol.Result put(java.lang.Object target, long propertyId, java.lang.Object value, CallProtocol callProtocol)
MetaobjectProtocol
BaseMetaobjectProtocol.put(Object, Object, Object,CallProtocol)
with an integer property ID.
Associates a value with a property in the target object.
put
in interface MetaobjectProtocol
put
in class BeanMetaobjectProtocol<T>
target
- the target objectpropertyId
- the ID of the property. Usually a String or an
Integer, but other property ID types can also be supported.value
- the new value for the propertycallProtocol
- a marshaller that is used to convert the value in
case the property can only accept values of certain types, and the
metaobject protocol allows automatic coercing to those types.
BaseMetaobjectProtocol.Result.doesNotExist
. If the protocol can not set the new value,
it will return BaseMetaobjectProtocol.Result.notWritable
. If the protocol
doesn't have the authority to put the new property value, it will leave
the object unchanged, and return BaseMetaobjectProtocol.Result.noAuthority
. If the
operation succeeds, BaseMetaobjectProtocol.Result.ok
is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |