Package jodd.proxetta
Class ProxettaFactory<T extends ProxettaFactory,P extends Proxetta>
- java.lang.Object
-
- jodd.proxetta.ProxettaFactory<T,P>
-
- Direct Known Subclasses:
InvokeProxettaFactory,ProxyProxettaFactory,WrapperProxettaFactory
public abstract class ProxettaFactory<T extends ProxettaFactory,P extends Proxetta> extends java.lang.ObjectProxetta builder. WhileProxettaonly holds aspects and configuration,ProxettaBuilderdeals with the actually building proxies and wrappers over provided target.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassWriterdestClassWriterprotected Pproxettaprotected booleanproxyAppliedprotected java.lang.StringproxyClassNameprotected java.lang.StringrequestedProxyClassNameRequested proxy class name (or class name template).protected static intsuffixCounterNumber appended to proxy class name, incremented on each use to make classnames unique in the system (e.g.
-
Constructor Summary
Constructors Modifier Constructor Description protectedProxettaFactory(P proxetta)Creates new builder.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected T_this()protected voidassertProxyIsCreated()Checks if proxy is created and throws an exception if not.byte[]create()Returns byte array of created class.java.lang.Classdefine()Defines class.protected voiddumpClassInDebugFolder(byte[] bytes)Writes created class content to output folder for debugging purposes.java.lang.StringgetProxyClassName()Returns proxy class name.booleanisProxyApplied()Returnstrueif at least one method was wrapped.java.lang.ObjectnewInstance()Creates new instance of created class.protected voidprocess()Reads the target and creates destination class.protected abstract WorkDataprocess(ClassReader cr, TargetClassInfoReader targetClassInfoReader)Creates custom class builder and process the target class with it.protected java.lang.StringresolveClassNameSuffix()Returns new suffix ornullif suffix is not in use.protected TsetTarget(java.io.InputStream target)Defines class input stream as a target.TsetTarget(java.lang.Class target)Defines class as a target.protected TsetTarget(java.lang.String targetName)Defines class name as a target.TsetTargetProxyClassName(java.lang.String targetProxyClassName)Sets requested proxy class name.protected byte[]toByteArray()Returns raw bytecode.
-
-
-
Field Detail
-
requestedProxyClassName
protected java.lang.String requestedProxyClassName
Requested proxy class name (or class name template).
-
suffixCounter
protected static int suffixCounter
Number appended to proxy class name, incremented on each use to make classnames unique in the system (e.g. classloader).- See Also:
Proxetta.setVariableClassName(boolean)
-
destClassWriter
protected ClassWriter destClassWriter
-
proxyApplied
protected boolean proxyApplied
-
proxyClassName
protected java.lang.String proxyClassName
-
-
Constructor Detail
-
ProxettaFactory
protected ProxettaFactory(P proxetta)
Creates new builder.
-
-
Method Detail
-
_this
protected T _this()
-
setTargetProxyClassName
public T setTargetProxyClassName(java.lang.String targetProxyClassName)
Sets requested proxy class name.
-
setTarget
protected T setTarget(java.io.InputStream target)
Defines class input stream as a target.
-
setTarget
protected T setTarget(java.lang.String targetName)
Defines class name as a target. Class will not be loaded by classloader!
-
setTarget
public T setTarget(java.lang.Class target)
Defines class as a target.
-
resolveClassNameSuffix
protected java.lang.String resolveClassNameSuffix()
Returns new suffix ornullif suffix is not in use.
-
process
protected abstract WorkData process(ClassReader cr, TargetClassInfoReader targetClassInfoReader)
Creates custom class builder and process the target class with it.
-
process
protected void process()
Reads the target and creates destination class.
-
create
public byte[] create()
Returns byte array of created class.
-
define
public java.lang.Class define()
Defines class.
-
newInstance
public java.lang.Object newInstance()
Creates new instance of created class. Assumes default no-arg constructor.
-
dumpClassInDebugFolder
protected void dumpClassInDebugFolder(byte[] bytes)
Writes created class content to output folder for debugging purposes.
-
assertProxyIsCreated
protected void assertProxyIsCreated()
Checks if proxy is created and throws an exception if not.
-
toByteArray
protected byte[] toByteArray()
Returns raw bytecode.
-
isProxyApplied
public boolean isProxyApplied()
Returnstrueif at least one method was wrapped.
-
getProxyClassName
public java.lang.String getProxyClassName()
Returns proxy class name.
-
-