B
- The type modeled by this ClassAccessor
.public interface ClassAccessor<B>
Modifier and Type | Method and Description |
---|---|
BeanProperties<B> |
getProperties()
Provides access to the
BeanProperties defined by the wrapped class. |
BeanAccessor<B> |
invokeConstructor(Argument<?>... arguments)
Invokes the constructor with the parameter list represented by
arguments on the wrapped class. |
BeanAccessor<B> |
invokeExactConstructor(Argument<?>... arguments)
Invokes the constructor with the parameter list represented by
arguments on the wrapped class. |
ArgumentsAccessor |
invokeExactStatic(String methodName)
Invokes the method with name
methodName on the wrapped class. |
ArgumentsAccessor |
invokeStatic(String methodName)
Invokes the method with name
methodName on the wrapped class. |
BeanAccessor<B> |
newInstance()
Creates a new instance of type
B by calling the parameterless constructor of the wrapped class. |
BeanAccessor<B> newInstance()
B
by calling the parameterless constructor of the wrapped class.BeanAccessor
that wraps the new instance.BeanInstantiationException
- if the class wrapped by this ClassAccessor
is not instantiable (for
example if it is a primitive type).NoSuchConstructorException
- if the class wrapped by this ClassAccessor
does not provide a default
constructor.ConstructorNotAccessibleException
- if the constructor is not accessible.ConstructorInvocationException
- if the constructor invocation threw an exception.BeanAccessor<B> invokeConstructor(Argument<?>... arguments)
arguments
on the wrapped class. Primitive
types may be converted to wrapper types and vice versa to match the methods signature.arguments
- the list of arguments to invoke the constructor with. None of the Argument
objects must
be null
. If you want to pass null
to the constructor use
Argument.nullArgument(Class)
.BeanAccessor
that wrapped the new instanceBeanInstantiationException
- if the class wrapped by this ClassAccessor
is not instantiable (for
example if it is a primitive type).NoSuchConstructorException
- if no constructor that matches arguments
can be found.ConstructorNotAccessibleException
- if the constructor is not accessible.ConstructorInvocationException
- if the constructor invocation threw an exception.BeanAccessor<B> invokeExactConstructor(Argument<?>... arguments)
arguments
on the wrapped class. Invoking
an exact constructor in this context means to not perform any type conversations during invocation.arguments
- the list of arguments to invoke the constructor with. None of the Argument
objects must
be null
. If you want to pass null
to the constructor use
Argument.nullArgument(Class)
.BeanAccessor
that wrapped the new instanceBeanInstantiationException
- if the class wrapped by this ClassAccessor
is not instantiable (for
example if it is a primitive type).NoSuchConstructorException
- if no constructor that matches arguments
exactly (without type
conversation) can be found.ConstructorNotAccessibleException
- if the constructor is not accessible.ConstructorInvocationException
- if the constructor invocation threw an exception.BeanProperties<B> getProperties()
BeanProperties
defined by the wrapped class.BeanProperties
for the wrapped class.ArgumentsAccessor invokeStatic(String methodName)
methodName
on the wrapped class. Primitive types may be converted to wrapper
types and vice versa to match the methods signature.methodName
- the name of the method to invoke. Must not be null
!ArgumentsAccessor
for this method invocation.ArgumentsAccessor invokeExactStatic(String methodName)
methodName
on the wrapped class. Invoking an exact method in this context
means to not perform any type conversations during invocation.methodName
- the name of the method to invoke. Must not be null
!ArgumentsAccessor
for this method invocation.Copyright © 2012–2014 The Apache Software Foundation. All rights reserved.