public abstract class Proxetta<T extends Proxetta,A>
extends java.lang.Object
To wrap a class with proxy Proxetta needs a target class (or its name or InputStream
)
and one or more proxy aspects
that will be applied to target.
Proxetta will examine target class and check if there are any methods to wrap, as defined by aspects pointcut.
If there is at least one matched method, new proxy class will be created that extends target class.
If no matching method founded, Proxetta may or may not create an empty proxy class. This behaviour is defined by forced mode during creation.
There are several options that describes how proxy class will be named. By default, proxy class name is created from target class name by adding default suffix. Suffix can be changed, also, name can be variable, so each time class is created it will have a new name.
It is also possible to set proxy simple class name and/or package name. This is useful when proxyfing JDK classes or any other that can't be loaded by some classloader. Requested proxy name can be in the following forms:
ProxettaFactory
Modifier and Type | Field and Description |
---|---|
protected java.lang.ClassLoader |
classLoader |
protected java.lang.String |
classNameSuffix |
protected java.io.File |
debugFolder |
protected boolean |
forced |
protected java.util.List<A> |
proxyAspectList |
protected boolean |
variableClassName |
Constructor and Description |
---|
Proxetta() |
Modifier and Type | Method and Description |
---|---|
protected T |
_this() |
A[] |
getAspects(A[] array) |
java.lang.ClassLoader |
getClassLoader()
Returns specified classloader for loading created classes.
|
java.lang.String |
getClassNameSuffix() |
java.io.File |
getDebugFolder()
Returns debug folder or
null if debug folder does not exist. |
static InvokeProxetta |
invokeProxetta()
Creates a new instance of
InvokeProxetta . |
boolean |
isForced() |
boolean |
isVariableClassName() |
abstract ProxettaFactory |
proxy()
Creates
ProxettaFactory with of this Proxetta. |
static ProxyProxetta |
proxyProxetta()
Creates a new instance of
ProxyProxetta . |
T |
setClassLoader(java.lang.ClassLoader classLoader)
Specifies classloaders for loading created classes.
|
T |
setClassNameSuffix(java.lang.String suffix)
Specifies custom classname suffix to be added to the class name of created proxy.
|
T |
setDebugFolder(java.io.File debugFolder) |
T |
setDebugFolder(java.lang.String debugFolder)
Specifies the debug folder where all created classes will be
written to, for debugging purposes.
|
T |
setForced(boolean forced)
Specifies 'forced' mode.
|
T |
setVariableClassName(boolean variableClassName)
Sets variable proxy class name so every time when new proxy class is created
its name will be different,so one classloader may load it without a problem.
|
T |
withAspect(A proxyAspect)
Adds an aspect.
|
T |
withAspects(A... aspects) |
static WrapperProxetta |
wrapperProxetta()
Creates a new instance of
WrapperProxetta . |
protected boolean forced
protected java.lang.ClassLoader classLoader
protected boolean variableClassName
protected java.lang.String classNameSuffix
protected java.io.File debugFolder
protected final java.util.List<A> proxyAspectList
public static WrapperProxetta wrapperProxetta()
WrapperProxetta
.public static ProxyProxetta proxyProxetta()
ProxyProxetta
.public static InvokeProxetta invokeProxetta()
InvokeProxetta
.protected T _this()
public T setForced(boolean forced)
true
, new proxy class will be created even if there are no
matching pointcuts. If false
, new proxy class will be created only if there is at least one
matching pointcut - otherwise, original class will be returned.public boolean isForced()
public T setClassLoader(java.lang.ClassLoader classLoader)
public java.lang.ClassLoader getClassLoader()
null
.public T setVariableClassName(boolean variableClassName)
This prevents "java.lang.LinkageError: duplicate class definition
" errors.
public boolean isVariableClassName()
public T setClassNameSuffix(java.lang.String suffix)
public java.lang.String getClassNameSuffix()
public T setDebugFolder(java.lang.String debugFolder)
public T setDebugFolder(java.io.File debugFolder)
public java.io.File getDebugFolder()
null
if debug folder does not exist.public abstract ProxettaFactory proxy()
ProxettaFactory
with of this Proxetta.Copyright © 2003-present Jodd Team