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

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.impl.accessor.PojoPropertyAccessorProxySetByIndex
All Implemented Interfaces:
PojoPropertyAccessor, PojoPropertyAccessorOneArg, PojoAttributeName

public class PojoPropertyAccessorProxySetByIndex
extends AbstractPojoPropertyAccessorProxy
implements PojoPropertyAccessorOneArg

This is an implementation of the PojoPropertyAccessorOneArg acting as as a setter that delegates to a indexed-setter using a fixed index.

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

Field Summary
private  PojoPropertyAccessorIndexedOneArg delegate
           
private  int index
           
 
Constructor Summary
PojoPropertyAccessorProxySetByIndex(PojoPropertyAccessorIndexedOneArg delegate, int index)
          The constructor.
 
Method Summary
protected  PojoPropertyAccessorIndexedOneArg getDelegate()
          This method gets the accessor this proxy delegates to.
 PojoPropertyAccessorOneArgMode getMode()
          This method gets the mode of this accessor.
 Object invoke(Object pojoInstance, Object argument)
          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.AbstractPojoPropertyAccessorProxy
getAccessibleObject, getDeclaringClass, getModifiers, getName, getPropertyClass, getPropertyType, getReturnClass, getReturnType
 
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, getReturnClass, getReturnType
 
Methods inherited from interface net.sf.mmm.util.pojo.descriptor.api.attribute.PojoAttributeName
getName
 

Field Detail

delegate

private final PojoPropertyAccessorIndexedOneArg delegate
See Also:
getDelegate()

index

private final int index
See Also:
invoke(Object, Object)
Constructor Detail

PojoPropertyAccessorProxySetByIndex

public PojoPropertyAccessorProxySetByIndex(PojoPropertyAccessorIndexedOneArg delegate,
                                           int index)
The constructor.

Parameters:
delegate - is the delegate.
index - is the index to use.
Method Detail

getMode

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

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

getDelegate

protected PojoPropertyAccessorIndexedOneArg getDelegate()
This method gets the accessor this proxy delegates to.

Specified by:
getDelegate in class AbstractPojoPropertyAccessorProxy
Returns:
the delegate.

invoke

public Object invoke(Object pojoInstance,
                     Object argument)
              throws ReflectionException
This method invokes the according property-method of pojoInstance with the given arguments.

Specified by:
invoke in interface PojoPropertyAccessorOneArg
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.
argument - is the value of the property to set.
Returns:
the result of the invocation. Will be null if void (e.g. regular setter method).
Throws:
ReflectionException - if the underlying accessor caused an error during reflection.


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