public abstract class MetaobjectProtocolBase extends java.lang.Object implements MetaobjectProtocol
MetaobjectProtocol that
requires you to only implement MetaobjectProtocolBase methods on it.BaseMetaobjectProtocol.Result| Constructor and Description |
|---|
MetaobjectProtocolBase() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
call(java.lang.Object target,
java.lang.Object callableId,
CallProtocol callProtocol,
java.util.Map args)
Calls a method on the target object with supplied named arguments.
|
java.lang.Object |
call(java.lang.Object target,
java.lang.Object callableId,
CallProtocol callProtocol,
java.lang.Object... args)
Calls a method on the target object with supplied positional arguments.
|
BaseMetaobjectProtocol.Result |
delete(java.lang.Object target,
long propertyId)
Behaves as
BaseMetaobjectProtocol.delete(Object, Object) with an
integer property ID. |
java.lang.Object |
get(java.lang.Object target,
long propertyId)
Behaves as
CallProtocol.get(Object, Object) with an
integer property ID. |
java.lang.Boolean |
has(java.lang.Object target,
long propertyId)
Behaves as
BaseMetaobjectProtocol.has(Object, Object) with an
integer property ID. |
java.util.Iterator<? extends 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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdelete, has, properties, putcall, call, get, representAspublic java.lang.Object call(java.lang.Object target,
java.lang.Object callableId,
CallProtocol callProtocol,
java.util.Map args)
MetaobjectProtocol
Object callable = get(target, callableId);
if(callable instanceof Result) {
return callable;
}
return call(callable, args);
call in interface MetaobjectProtocoltarget - the target objectcallableId - the ID of the method to callcallProtocol - 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 arguments of the callCallProtocol.get(Object, Object)
would return while looking up the callable. Can also return any return
value that CallProtocol.call(Object, CallProtocol, Map)
would return while calling.public java.lang.Object call(java.lang.Object target,
java.lang.Object callableId,
CallProtocol callProtocol,
java.lang.Object... args)
MetaobjectProtocol
Object callable = get(target, callableId);
if(callable instanceof Result) {
return callable;
}
return call(callable, args);
call in interface MetaobjectProtocoltarget - the target objectcallableId - the ID of the method to callcallProtocol - 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 arguments of the callCallProtocol.get(Object, Object)
would return while looking up the callable. Can also return any return
value that CallProtocol.call(Object, CallProtocol, Object[])
would return while calling.public BaseMetaobjectProtocol.Result delete(java.lang.Object target, long propertyId)
MetaobjectProtocolBaseMetaobjectProtocol.delete(Object, Object) with an
integer property ID.delete in interface MetaobjectProtocoltarget - the target objectpropertyId - the ID of the property.BaseMetaobjectProtocol.delete(Object, Object).public java.lang.Object get(java.lang.Object target,
long propertyId)
MetaobjectProtocolCallProtocol.get(Object, Object) with an
integer property ID.get in interface MetaobjectProtocoltarget - the target objectpropertyId - the ID of the property.CallProtocol.get(Object, Object).public java.lang.Boolean has(java.lang.Object target,
long propertyId)
MetaobjectProtocolBaseMetaobjectProtocol.has(Object, Object) with an
integer property ID.has in interface MetaobjectProtocoltarget - the target objectpropertyId - the ID of the property.BaseMetaobjectProtocol.has(Object, Object).public java.util.Iterator<? extends java.lang.Object> propertyIds(java.lang.Object target)
MetaobjectProtocolpropertyIds in interface MetaobjectProtocoltarget - the target objectpublic BaseMetaobjectProtocol.Result put(java.lang.Object target, long propertyId, java.lang.Object value, CallProtocol callProtocol)
MetaobjectProtocolBaseMetaobjectProtocol.put(Object, Object, Object,CallProtocol)
with an integer property ID.
Associates a value with a property in the target object.put in interface MetaobjectProtocoltarget - 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.