Package jodd.proxetta
Class ProxyTarget
- java.lang.Object
-
- jodd.proxetta.ProxyTarget
-
public final class ProxyTarget extends java.lang.ObjectMarker class forproxyimplementations.
-
-
Constructor Summary
Constructors Constructor Description ProxyTarget()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Objectargument(int index)Inserts value of method argument specified by 1-based index.static intargumentsCount()Inserts total number of method's arguments.static java.lang.ClassargumentType(int index)Inserts type of method argument specified by 1-based index.static java.lang.Object[]createArgumentsArray()Creates array of arguments values.static java.lang.Class[]createArgumentsClassArray()Creates array of arguments types.static ProxyTargetInfoinfo()Inserts populatedProxyTargetInfoinstance.static java.lang.Objectinvoke()Inserts the invocation of target method and getting the invocation results.static java.lang.ClassreturnType()Inserts return type of target method.static java.lang.ObjectreturnValue(java.lang.Object value)Prepares return value.static voidsetArgument(java.lang.Object value, int index)Assigns new value for an argument specified by 1-based index.static java.lang.Objecttarget()Inserts proxy (i.e.static java.lang.ClasstargetClass()Inserts target class.static java.lang.ObjecttargetClassAnnotation(java.lang.String annotationClassName, java.lang.String element)Inserts targets class annotation value.static java.lang.ObjecttargetMethodAnnotation(java.lang.String annotationClassName, java.lang.String element)Inserts targets method annotation value.static java.lang.StringtargetMethodDescription()Inserts target method description, bytecode alike, without method name.static java.lang.StringtargetMethodName()Inserts target method name.static java.lang.StringtargetMethodSignature()Inserts target method signature, java alike, including the method name.
-
-
-
Method Detail
-
invoke
public static java.lang.Object invoke()
Inserts the invocation of target method and getting the invocation results. Small types are converted to wrappers. If method isvoid,nullis used for return value.
-
argumentsCount
public static int argumentsCount()
Inserts total number of method's arguments.
-
argumentType
public static java.lang.Class argumentType(int index)
Inserts type of method argument specified by 1-based index. Works correctly withnullargument values.- See Also:
createArgumentsClassArray()
-
argument
public static java.lang.Object argument(int index)
Inserts value of method argument specified by 1-based index.- See Also:
createArgumentsArray()
-
setArgument
public static void setArgument(java.lang.Object value, int index)Assigns new value for an argument specified by 1-based index.
-
createArgumentsArray
public static java.lang.Object[] createArgumentsArray()
Creates array of arguments values. It is more safely then to get one argument at time, since the returned array has correct length. Equals to:new Object[] {arg1, arg2,...}- See Also:
createArgumentsClassArray(),argument(int)
-
createArgumentsClassArray
public static java.lang.Class[] createArgumentsClassArray()
Creates array of arguments types. Works correctly withnullargument values. Equals to:new Class[] {Arg1Type.class, Arg2Type.class...}- See Also:
createArgumentsArray(),argumentType(int)
-
returnType
public static java.lang.Class returnType()
Inserts return type of target method.nullis used for void.
-
returnValue
public static java.lang.Object returnValue(java.lang.Object value)
Prepares return value. Must be used as last method call:... return ProxyTarget.returnValue(xxx);Used when returning values in general case, when return type may be either primitive or an object. Also, must be used when returningnullfor primitives.
-
target
public static java.lang.Object target()
Inserts proxy (i.e. target) instance.
-
targetClass
public static java.lang.Class targetClass()
Inserts target class.
-
targetMethodName
public static java.lang.String targetMethodName()
Inserts target method name. Useful for reflection.
-
targetMethodSignature
public static java.lang.String targetMethodSignature()
Inserts target method signature, java alike, including the method name. Useful for identifying the method, since it is unique for class.- See Also:
targetMethodDescription()
-
targetMethodDescription
public static java.lang.String targetMethodDescription()
Inserts target method description, bytecode alike, without method name. May be used for identifying the method.- See Also:
targetMethodSignature()
-
targetMethodAnnotation
public static java.lang.Object targetMethodAnnotation(java.lang.String annotationClassName, java.lang.String element)Inserts targets method annotation value. Insertsnullif annotation or element is missing.
-
targetClassAnnotation
public static java.lang.Object targetClassAnnotation(java.lang.String annotationClassName, java.lang.String element)Inserts targets class annotation value. Insertsnullif annotation or element is missing.
-
info
public static ProxyTargetInfo info()
Inserts populatedProxyTargetInfoinstance.
-
-