org.specrunner.parameters.core
Class AccessImpl

java.lang.Object
  extended by org.specrunner.parameters.core.AccessImpl
All Implemented Interfaces:
IAccess

public class AccessImpl
extends Object
implements IAccess

Default implementation of IAccess.

Author:
Thiago Santos

Constructor Summary
AccessImpl(Field field)
          Basic filed access constructor.
AccessImpl(Method method)
          Basic method access constructor.
AccessImpl(PropertyDescriptor property)
          Basic bean access constructor.
 
Method Summary
 Class<?>[] expected(Object target, String name, Object... args)
          Get the expected type(s) for a feature.
 Object get(Object target, String name, Object... args)
          Get the feature value.
 Annotation[] getAnnotations()
          Get the annotation information of a given access.
protected  Annotation[] getMethodAnnotations(Method method)
          Get annotation for methods.
 boolean hasFeature()
          Check if access has feature associated or null.
 void set(Object target, String name, Object... args)
          Set the value to a given feature.
 String toString()
           
 boolean valid(Object target, String name, Object... args)
          Check if the given arguments are compatible with the feature named.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AccessImpl

public AccessImpl(Field field)
Basic filed access constructor.

Parameters:
field - The field.

AccessImpl

public AccessImpl(PropertyDescriptor property)
Basic bean access constructor.

Parameters:
property - The bean property.

AccessImpl

public AccessImpl(Method method)
Basic method access constructor.

Parameters:
method - The method.
Method Detail

set

public void set(Object target,
                String name,
                Object... args)
         throws Exception
Description copied from interface: IAccess
Set the value to a given feature.

Specified by:
set in interface IAccess
Parameters:
target - The target object.
name - The feature reference.
args - The arguments.
Throws:
Exception - On processing errors.

getMethodAnnotations

protected Annotation[] getMethodAnnotations(Method method)
Get annotation for methods.

Parameters:
method - The write method.
Returns:
The annotations.

get

public Object get(Object target,
                  String name,
                  Object... args)
           throws Exception
Description copied from interface: IAccess
Get the feature value.

Specified by:
get in interface IAccess
Parameters:
target - The target object.
name - The feature reference.
args - The arguments, if any.
Returns:
The value of feature.
Throws:
Exception - On processing errors.

valid

public boolean valid(Object target,
                     String name,
                     Object... args)
Description copied from interface: IAccess
Check if the given arguments are compatible with the feature named.

Specified by:
valid in interface IAccess
Parameters:
target - The target object.
name - The feature reference.
args - The arguments.
Returns:
true, if compatible, false, otherwise.

expected

public Class<?>[] expected(Object target,
                           String name,
                           Object... args)
Description copied from interface: IAccess
Get the expected type(s) for a feature.

Specified by:
expected in interface IAccess
Parameters:
target - The target object.
name - The feature reference.
args - The arguments.
Returns:
true, if compatible, false, otherwise.

hasFeature

public boolean hasFeature()
Description copied from interface: IAccess
Check if access has feature associated or null.

Specified by:
hasFeature in interface IAccess
Returns:
true, for any associated feature, false, otherwise.

getAnnotations

public Annotation[] getAnnotations()
Description copied from interface: IAccess
Get the annotation information of a given access.

Specified by:
getAnnotations in interface IAccess
Returns:
The list of annotations associated to the access.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All rights reserved.