public class ListMetaobjectProtocol extends java.lang.Object implements ClassBasedMetaobjectProtocol
BaseMetaobjectProtocol.Result| Constructor and Description |
|---|
ListMetaobjectProtocol() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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)
Handles the delete attempt from the list.
|
BaseMetaobjectProtocol.Result |
delete(java.lang.Object target,
java.lang.Object propertyId)
Handles the delete attempt from the list.
|
java.lang.Object |
get(java.lang.Object target,
long propertyId)
Retrieves a value from the list.
|
java.lang.Object |
get(java.lang.Object target,
java.lang.Object propertyId)
Retrieves a value from the list.
|
java.lang.Boolean |
has(java.lang.Object target,
long propertyId)
Tells whether the index is valid for the list.
|
java.lang.Boolean |
has(java.lang.Object target,
java.lang.Object propertyId)
Tells whether the index is valid for the list.
|
boolean |
isAuthoritativeForClass(java.lang.Class clazz)
Returns whether this metaobject protocol has authority over objects of
the specified class.
|
java.util.Iterator<java.util.Map.Entry> |
properties(java.lang.Object target)
Returns mappings from indexes to elements for a list.
|
java.util.Iterator<? extends java.lang.Object> |
propertyIds(java.lang.Object target)
Returns an iterator over all indexes in a list
|
BaseMetaobjectProtocol.Result |
put(java.lang.Object target,
long propertyId,
java.lang.Object value,
CallProtocol callProtocol)
Puts an element into the list.
|
BaseMetaobjectProtocol.Result |
put(java.lang.Object target,
java.lang.Object propertyId,
java.lang.Object value,
CallProtocol callProtocol)
Puts an element into the list.
|
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.
|
public boolean isAuthoritativeForClass(java.lang.Class clazz)
ClassBasedMetaobjectProtocolBaseMetaobjectProtocol.Result.noAuthority for certain objects.
In that case - when used in CompositeClassBasedMetaobjectProtocol
- the other participating MOPs will also be given the chance to handle
the object after this MOP was given the chance first.isAuthoritativeForClass in interface ClassBasedMetaobjectProtocolclazz - the class of the handled objectpublic java.lang.Object call(java.lang.Object callable,
CallProtocol callProtocol,
java.util.Map args)
CallProtocolcall in interface CallProtocolcallable - 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.Result#noAuthority as this MOP has no concept of callablespublic java.lang.Object call(java.lang.Object callable,
CallProtocol callProtocol,
java.lang.Object... args)
CallProtocolcall in interface CallProtocolcallable - 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.Result#noAuthority as this MOP has no concept of callablespublic 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 callBaseMetaobjectProtocol.Result#noAuthority as this MOP has no concept of callablespublic 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 callBaseMetaobjectProtocol.Result#noAuthority as this MOP has no concept of callablespublic BaseMetaobjectProtocol.Result delete(java.lang.Object target, long propertyId)
delete in interface MetaobjectProtocoltarget - the list to remove element frompropertyId - the numeric index of the elementBaseMetaobjectProtocol.Result#notDeleteable is returned. If the index is out of
bounds, or the target is not a list, BaseMetaobjectProtocol.Result#noAuthority
is returned.public BaseMetaobjectProtocol.Result delete(java.lang.Object target, java.lang.Object propertyId)
delete in interface BaseMetaobjectProtocoltarget - the list to remove element frompropertyId - the numeric index of the elementBaseMetaobjectProtocol.Result#notDeleteable is returned.
If the index is out of bounds, or the target is not a list,
BaseMetaobjectProtocol.Result#noAuthority is returned.public java.lang.Object get(java.lang.Object target,
long propertyId)
get in interface MetaobjectProtocoltarget - the list to retrieve frompropertyId - the numeric index of the elementBaseMetaobjectProtocol.Result#noAuthority is returned.public java.lang.Object get(java.lang.Object target,
java.lang.Object propertyId)
get in interface CallProtocoltarget - the list to retrieve frompropertyId - the numeric index of the elementNumber.longValue(), returns it. If the index is out of bounds,
or it is not an instance of Number, or the target is not a list,
BaseMetaobjectProtocol.Result#noAuthority is returned.public java.lang.Boolean has(java.lang.Object target,
long propertyId)
has in interface MetaobjectProtocoltarget - the listpropertyId - the indexBoolean.TRUE. If it is not valid, or the target is not a list,
returns null (meaning, no authority).public java.lang.Boolean has(java.lang.Object target,
java.lang.Object propertyId)
has in interface BaseMetaobjectProtocoltarget - the listpropertyId - the indexNumber.longValue() of propertyId is a valid index for
this list, returns Boolean.TRUE. If it is not valid, or the
target is not a list, or propertyId is not a Number, returns
null (meaning, no authority).public java.util.Iterator<java.util.Map.Entry> properties(java.lang.Object target)
properties in interface BaseMetaobjectProtocoltarget - the listInteger objects.
The iterator does not support removal.public java.util.Iterator<? extends java.lang.Object> propertyIds(java.lang.Object target)
propertyIds in interface MetaobjectProtocoltarget - the listInteger objects).
The iterator does not support removal.public BaseMetaobjectProtocol.Result put(java.lang.Object target, long propertyId, java.lang.Object value, CallProtocol callProtocol)
put in interface MetaobjectProtocoltarget - the list to put the element intopropertyId - the numeric index of the elementcallProtocol - not usedvalue - the new value for the propertyBaseMetaobjectProtocol.Result#ok if the put was successful. If the list is
read-only (throws a UnsupportedOperationException on put
attempt), BaseMetaobjectProtocol.Result#notWritable is returned. If the index is
out of bounds, or the target is not a list, BaseMetaobjectProtocol.Result#noAuthority
is returned. If the list throws ClassCastException (because it
is limited in types of values it can accept),
BaseMetaobjectProtocol.Result#noRepresentation is returned.public BaseMetaobjectProtocol.Result put(java.lang.Object target, java.lang.Object propertyId, java.lang.Object value, CallProtocol callProtocol)
put in interface BaseMetaobjectProtocoltarget - the list to put the element intopropertyId - the numeric index of the element. If this argument is
a Number, it's Number.longValue() method is used.callProtocol - not usedvalue - the new value for the propertyBaseMetaobjectProtocol.Result#ok if the put was successful. If the list is
read-only (throws a UnsupportedOperationException on put
attempt), BaseMetaobjectProtocol.Result#notWritable is returned. If the index is
out of bounds, or is not a Number, or the target is not a list,
BaseMetaobjectProtocol.Result#noAuthority is returned. If the list throws
ClassCastException (because it is limited in types of values it
can accept), BaseMetaobjectProtocol.Result#noRepresentation is returned.public java.lang.Object representAs(java.lang.Object object,
java.lang.Class targetClass)
CallProtocolrepresentAs in interface CallProtocolobject - the object to representtargetClass - the target class for representation.BaseMetaobjectProtocol.Result#noAuthority as this MOP has no concept of type
conversion