public class ListMetaobjectProtocol extends java.lang.Object implements ClassBasedMetaobjectProtocol
BaseMetaobjectProtocol.Results
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.Results |
delete(java.lang.Object target,
long propertyId)
Handles the delete attempt from the list.
|
BaseMetaobjectProtocol.Results |
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.Results |
put(java.lang.Object target,
long propertyId,
java.lang.Object value,
CallProtocol callProtocol)
Puts an element into the list.
|
BaseMetaobjectProtocol.Results |
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)
ClassBasedMetaobjectProtocol
BaseMetaobjectProtocol.Results.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 ClassBasedMetaobjectProtocol
clazz
- the class of the handled objectpublic java.lang.Object call(java.lang.Object callable, CallProtocol callProtocol, java.util.Map args)
CallProtocol
call
in interface 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#noAuthority
as this MOP has no concept of callablespublic java.lang.Object call(java.lang.Object callable, CallProtocol callProtocol, java.lang.Object... args)
CallProtocol
call
in interface 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#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 Results) { return callable; } return call(callable, args);
call
in interface MetaobjectProtocol
target
- 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.Results#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 Results) { return callable; } return call(callable, args);
call
in interface MetaobjectProtocol
target
- 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.Results#noAuthority
as this MOP has no concept of callablespublic BaseMetaobjectProtocol.Results delete(java.lang.Object target, long propertyId)
delete
in interface MetaobjectProtocol
target
- the list to remove element frompropertyId
- the numeric index of the elementBaseMetaobjectProtocol.Results#notDeleteable
is returned. If the index is out of
bounds, or the target is not a list, BaseMetaobjectProtocol.Results#noAuthority
is returned.public BaseMetaobjectProtocol.Results delete(java.lang.Object target, java.lang.Object propertyId)
delete
in interface BaseMetaobjectProtocol
target
- the list to remove element frompropertyId
- the numeric index of the elementBaseMetaobjectProtocol.Results#notDeleteable
is returned.
If the index is out of bounds, or the target is not a list,
BaseMetaobjectProtocol.Results#noAuthority
is returned.public java.lang.Object get(java.lang.Object target, long propertyId)
get
in interface MetaobjectProtocol
target
- the list to retrieve frompropertyId
- the numeric index of the elementBaseMetaobjectProtocol.Results#noAuthority
is returned.public java.lang.Object get(java.lang.Object target, java.lang.Object propertyId)
get
in interface CallProtocol
target
- 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.Results#noAuthority
is returned.public java.lang.Boolean has(java.lang.Object target, long propertyId)
has
in interface MetaobjectProtocol
target
- 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 BaseMetaobjectProtocol
target
- 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 BaseMetaobjectProtocol
target
- 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 MetaobjectProtocol
target
- the listInteger
objects).
The iterator does not support removal.public BaseMetaobjectProtocol.Results put(java.lang.Object target, long propertyId, java.lang.Object value, CallProtocol callProtocol)
put
in interface MetaobjectProtocol
target
- the list to put the element intopropertyId
- the numeric index of the elementcallProtocol
- not usedvalue
- the new value for the propertyBaseMetaobjectProtocol.Results#ok
if the put was successful. If the list is
read-only (throws a UnsupportedOperationException
on put
attempt), BaseMetaobjectProtocol.Results#notWritable
is returned. If the index is
out of bounds, or the target is not a list, BaseMetaobjectProtocol.Results#noAuthority
is returned. If the list throws ClassCastException
(because it
is limited in types of values it can accept),
BaseMetaobjectProtocol.Results#noRepresentation
is returned.public BaseMetaobjectProtocol.Results put(java.lang.Object target, java.lang.Object propertyId, java.lang.Object value, CallProtocol callProtocol)
put
in interface BaseMetaobjectProtocol
target
- 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.Results#ok
if the put was successful. If the list is
read-only (throws a UnsupportedOperationException
on put
attempt), BaseMetaobjectProtocol.Results#notWritable
is returned. If the index is
out of bounds, or is not a Number
, or the target is not a list,
BaseMetaobjectProtocol.Results#noAuthority
is returned. If the list throws
ClassCastException
(because it is limited in types of values it
can accept), BaseMetaobjectProtocol.Results#noRepresentation
is returned.public java.lang.Object representAs(java.lang.Object object, java.lang.Class targetClass)
CallProtocol
representAs
in interface CallProtocol
object
- the object to representtargetClass
- the target class for representation.BaseMetaobjectProtocol.Results#noAuthority
as this MOP has no concept of type
conversion