T - Type of class to be instancedpublic interface ObjectProxy<T>
| Modifier and Type | Method and Description |
|---|---|
T |
from(Object o)
copy all data from properties started with
get or is to instance of this proxy |
<T extends Annotation> |
getAnnotationField(Class<? extends Annotation> annotation,
String fieldName)
check if this proxy class has
annotation for a method name |
<T extends Annotation> |
getAnnotationMethod(Class<? extends Annotation> annotation,
String methodName,
Class<?>... paramTypes)
check if this proxy class has
annotation for a method name |
Field |
getDeclaredField(String name)
get the
Field declared by the class or sub-class represented by this proxy |
Method |
getDeclaredMethod(String name)
get the
Method declared by the class or sub-class represented by this proxy |
T |
getInstance() |
List<Method> |
getMethodsAnnotatedWith(Class<? extends Annotation> annotation)
Retrieve all public methods annotated with
annotation |
Class<T> |
getTargetClass() |
boolean |
hasAnnotation(Class<? extends Annotation> annotation)
check if this proxy class has
annotation |
boolean |
hasAnnotation(String annotation)
check if this proxy class has
annotation |
boolean |
hasInstance()
check if instance exists
|
boolean |
hasMethod(String methodName)
check if class has a
methodName to be invoked. |
Object |
invoke(Method method,
Object... args) |
Object |
invoke(String methodName,
Object... args) |
boolean |
isInstanceof(Class<?> clazz) |
T |
merge(Object o)
merge all data from properties started with
get or is to instance of this proxy |
ObjectProxy<T> |
mute(Class<? extends Exception> ex)
When the proxy catch a Exception to handler by
ReflectionException
a mute rule is used to not throw the exception. |
T |
newInstance()
build a new instance using constructor with arguments types or default
|
void |
register(TranslateType cast,
Class type) |
void |
setConstructorArgs(Object... constructorArgs)
Arguments to build object using contructor
|
void |
setConstructorTypes(Class<?>... contructorTypes)
Sequential type arguments from constructor
|
ObjectProxy<T> |
with(HandleableException handle) |
void setConstructorArgs(Object... constructorArgs)
constructorArgs - argument valuesvoid setConstructorTypes(Class<?>... contructorTypes)
contructorTypes - type of argumentsReflectionException - if some type is nullT newInstance()
ReflectionException - if an instance already existsboolean hasInstance()
true when instance exists, false otherwiseboolean isInstanceof(Class<?> clazz)
boolean hasMethod(String methodName)
methodName to be invoked.methodName - complete method name like isDeleted, setName...true when the class has the name, false otherwiseT getInstance()
Class<T> getTargetClass()
T from(Object o)
get or is to instance of this proxyo - origin object dataoReflectionException - when some wrong occursT merge(Object o)
get or is to instance of this proxyo - origin object dataoReflectionException - when some wrong occursObjectProxy<T> mute(Class<? extends Exception> ex)
ReflectionException
a mute rule is used to not throw the exception.ex - exception class typeboolean hasAnnotation(String annotation)
annotationannotation - name of annotationtrue when the class has this annotation, false otherwiseboolean hasAnnotation(Class<? extends Annotation> annotation)
annotationannotation - name of annotationtrue when the class has this annotation, false otherwiseList<Method> getMethodsAnnotatedWith(Class<? extends Annotation> annotation)
annotationannotation - looked forannotation or empty list otherwise.<T extends Annotation> T getAnnotationMethod(Class<? extends Annotation> annotation, String methodName, Class<?>... paramTypes)
annotation for a method nameT - generic type to returnannotation - name of the annotationmethodName - name of the methodparamTypes - type of parametersnull if not foundReflectionException - when the methodName not exists<T extends Annotation> T getAnnotationField(Class<? extends Annotation> annotation, String fieldName)
annotation for a method nameT - generic type to returnannotation - name of the annotationfieldName - attribute namenull if not foundReflectionException - when the attributeName not existsField getDeclaredField(String name)
Field declared by the class or sub-class represented by this proxyname - field to looking fornull if not foundMethod getDeclaredMethod(String name)
Method declared by the class or sub-class represented by this proxyname - method to looking fornull if not foundObjectProxy<T> with(HandleableException handle)
void register(TranslateType cast, Class type)
Copyright © 2012–2020 jkniv, copyleft code. All rights reserved.