|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dynalang.mop.impl.MetaobjectProtocolBase org.dynalang.mop.impl.BottomMetaobjectProtocol
public class BottomMetaobjectProtocol
An implementation for "bottom" metaobject protocol, one that returns authoritative answer for all methods, and claims nonexistence (and non-callability) for everything. Useful as a last element in a composite metaobject protocol if the user of the composite metaobject protocol is not able or not willing to deal with non-authoritative answers.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.dynalang.mop.BaseMetaobjectProtocol |
---|
BaseMetaobjectProtocol.Results |
Constructor Summary | |
---|---|
BottomMetaobjectProtocol()
|
Method Summary | |
---|---|
java.lang.Object |
call(java.lang.Object callable,
CallProtocol callProtocol,
java.util.Map args)
Calls a callable object with named arguments. |
java.lang.Object |
call(java.lang.Object callable,
CallProtocol callProtocol,
java.lang.Object... args)
Calls a callable object with positional arguments. |
BaseMetaobjectProtocol.Results |
delete(java.lang.Object target,
java.lang.Object propertyId)
Deletes an association of a value with a property in the target object. |
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,
java.lang.Object propertyId)
Tells whether the target object has a particular property. |
java.util.Iterator<java.util.Map.Entry> |
properties(java.lang.Object target)
Returns an iterator over the property ID-value pairs in the target object this MOP knows about (and chooses to expose - not all properties must be exposed; hidden properties are allowed). |
BaseMetaobjectProtocol.Results |
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. |
java.lang.Object |
representAs(java.lang.Object object,
java.lang.Class targetClass)
Returns a representation of the specified target object as an object of the specified target class. |
Methods inherited from class org.dynalang.mop.impl.MetaobjectProtocolBase |
---|
call, call, delete, get, has, propertyIds, put |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BottomMetaobjectProtocol()
Method Detail |
---|
public java.lang.Object call(java.lang.Object callable, CallProtocol callProtocol, java.util.Map args)
CallProtocol
callable
- the callable objectcallProtocol
- a marshaller that should be used by this
metaobject protocol to convert the arguments to conform to expected
argument types for the call.args
- the named arguments for the callable object. null must
be treated as empty map. Usually, the map keys are strings, but it is
possible that some protocols support non-string keys.
BaseMetaobjectProtocol.Results.notCallable
is returned if the protocol can
authoritatively decide that the target is not a callable, or is not
callable with named arguments. BaseMetaobjectProtocol.Results.doesNotExist
is returned
if the callable does not exist at all. BaseMetaobjectProtocol.Results.noAuthority
is
returned if the protocol can not authoritatively decide whether the
target is callable.public java.lang.Object call(java.lang.Object callable, CallProtocol callProtocol, java.lang.Object... args)
CallProtocol
callable
- the callable objectcallProtocol
- a marshaller that should be used by this
metaobject protocol to convert the arguments to conform to expected
argument types for the call.args
- the positional arguments for the callable object. null must
be treated as empty array.
BaseMetaobjectProtocol.Results.notCallable
is returned if the protocol can
authoritatively decide that the target is not a callable, or is not
callable with positional arguments. BaseMetaobjectProtocol.Results.doesNotExist
is
returned if the callable does not exist at all.
BaseMetaobjectProtocol.Results.noAuthority
is returned if the protocol can not
authoritatively decide whether the target is callable.public BaseMetaobjectProtocol.Results delete(java.lang.Object target, java.lang.Object propertyId)
BaseMetaobjectProtocol
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.Results.doesNotExist
. If the protocol authoritatively decides
that the property can not be deleted, it will return
BaseMetaobjectProtocol.Results.notDeleteable
. If the protocol doesn't have the
authority to delete the property, it will leave the object unchanged,
and return BaseMetaobjectProtocol.Results.noAuthority
. If the operation succeeds,
BaseMetaobjectProtocol.Results.ok
is returned.public java.lang.Object get(java.lang.Object target, java.lang.Object propertyId)
CallProtocol
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.Results.doesNotExist
. If the protocol decides that
the property exists, but is not readable, it will return
BaseMetaobjectProtocol.Results.notReadable
. If the protocol can not make
an authoritative decision, it will return BaseMetaobjectProtocol.Results.noAuthority
.public java.lang.Boolean has(java.lang.Object target, java.lang.Object propertyId)
BaseMetaobjectProtocol
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.util.Iterator<java.util.Map.Entry> properties(java.lang.Object target)
BaseMetaobjectProtocol
target
- the target object
public BaseMetaobjectProtocol.Results put(java.lang.Object target, java.lang.Object propertyId, java.lang.Object value, CallProtocol callProtocol)
BaseMetaobjectProtocol
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.Results.doesNotExist
. If the protocol
authoritatively decides that the property is read-only, it will return
BaseMetaobjectProtocol.Results.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.Results.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.Results.noAuthority
. If the operation succeeds,
BaseMetaobjectProtocol.Results.ok
is returned.public java.lang.Object representAs(java.lang.Object object, java.lang.Class targetClass)
CallProtocol
object
- the object to representtargetClass
- the target class for representation.
BaseMetaobjectProtocol.Results.noAuthority
is returned if the
marshaller can not authoritatively decide on a representation;
BaseMetaobjectProtocol.Results.noRepresentation
is returned if
the marshaller can authoritatively decide that the requested
representation is not possible. representation of null should be null,
except when the target class is a primitive type in which case
BaseMetaobjectProtocol.Results.noRepresentation
should be
returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |