net.sf.mmm.util.pojo.descriptor.impl.accessor
Class PojoPropertyAccessorProxySetIndexed

java.lang.Object
  extended by net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessor
      extended by net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorProxy
          extended by net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorProxyAdapter
              extended by net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorProxyAdapterComponentType
                  extended by net.sf.mmm.util.pojo.descriptor.impl.accessor.PojoPropertyAccessorProxySetIndexed
All Implemented Interfaces:
PojoPropertyAccessor, PojoPropertyAccessorIndexedOneArg, PojoAttributeName

public class PojoPropertyAccessorProxySetIndexed
extends AbstractPojoPropertyAccessorProxyAdapterComponentType
implements PojoPropertyAccessorIndexedOneArg

This is the implementation of the PojoPropertyAccessorIndexedOneArg interface for setting an indexed property using the getter from another accessor returning an array or List.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  PojoPropertyAccessorOneArg containerSetAccessor
          The according setter to use if array has to be resized.
 
Constructor Summary
PojoPropertyAccessorProxySetIndexed(PojoDescriptorDependencies dependencies, PojoPropertyAccessorNonArg containerGetAccessor, PojoPropertyAccessorOneArg containerSetAccessor)
          The constructor.
 
Method Summary
 PojoPropertyAccessorIndexedOneArgMode getMode()
          This method gets the mode of this accessor.
 Class<?> getReturnClass()
          This method gets the Class of the object returned when this accessor is invoked.
 GenericType<?> getReturnType()
          This method gets the GenericType of the object returned when this accessor is invoked.
 Object invoke(Object pojoInstance, int index, Object item)
          This method invokes the according property-method of pojoInstance with the given arguments.
 
Methods inherited from class net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorProxyAdapterComponentType
getPropertyClass, getPropertyType
 
Methods inherited from class net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorProxyAdapter
getDelegate, getDependencies
 
Methods inherited from class net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorProxy
getAccessibleObject, getDeclaringClass, getModifiers, getName
 
Methods inherited from class net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessor
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.pojo.descriptor.api.accessor.PojoPropertyAccessor
getAccessibleObject, getDeclaringClass, getModifiers, getPropertyClass, getPropertyType
 
Methods inherited from interface net.sf.mmm.util.pojo.descriptor.api.attribute.PojoAttributeName
getName
 

Field Detail

containerSetAccessor

private final PojoPropertyAccessorOneArg containerSetAccessor
The according setter to use if array has to be resized.

Constructor Detail

PojoPropertyAccessorProxySetIndexed

public PojoPropertyAccessorProxySetIndexed(PojoDescriptorDependencies dependencies,
                                           PojoPropertyAccessorNonArg containerGetAccessor,
                                           PojoPropertyAccessorOneArg containerSetAccessor)
The constructor.

Parameters:
dependencies - are the PojoDescriptorDependencies to use.
containerGetAccessor - is the accessor delegate that gets an array, or List property.
containerSetAccessor - is the accessor that sets the array, or List property. May be null if NOT available.
Method Detail

getMode

public PojoPropertyAccessorIndexedOneArgMode getMode()
This method gets the mode of this accessor.

Specified by:
getMode in interface PojoPropertyAccessor
Specified by:
getMode in interface PojoPropertyAccessorIndexedOneArg
Overrides:
getMode in class AbstractPojoPropertyAccessorProxy
Returns:
the access mode.

getReturnType

public GenericType<?> getReturnType()
This method gets the GenericType of the object returned when this accessor is invoked.

Specified by:
getReturnType in interface PojoPropertyAccessor
Overrides:
getReturnType in class AbstractPojoPropertyAccessorProxy
Returns:
the return type.
See Also:
Method.getGenericReturnType(), Field.getGenericType()

getReturnClass

public Class<?> getReturnClass()
This method gets the Class of the object returned when this accessor is invoked.
is a convenience method for PojoPropertyAccessor.getReturnType(). getUpperBound()

Specified by:
getReturnClass in interface PojoPropertyAccessor
Overrides:
getReturnClass in class AbstractPojoPropertyAccessorProxy
Returns:
the return class.
See Also:
Method.getReturnType(), Field.getType()

invoke

public Object invoke(Object pojoInstance,
                     int index,
                     Object item)
This method invokes the according property-method of pojoInstance with the given arguments.

Specified by:
invoke in interface PojoPropertyAccessorIndexedOneArg
Parameters:
pojoInstance - is the instance of the POJO where to access the property. Has to be an instance of the type from where this accessor was created for.
index - is the position in the indexed property where to apply (e.g. set or insert) the given item.
item - is the value to apply (e.g. set or insert) as element of the indexed property.
Returns:
the result of the invocation. Will be null if void (e.g. regular setter method).


Copyright © 2001-2010 mmm-Team. All Rights Reserved.