public class Weaver extends Object implements IErrorLogger
| Modifier and Type | Field and Description |
|---|---|
static String |
CATEGORY_ERROR_CLASSES |
static String |
CATEGORY_WOVEN_CLASSES |
static String |
CLASS_ID_FILE |
static String |
DATA_ID_FILE |
static String |
ERROR_LOG_FILE |
static String |
METHOD_ID_FILE |
static String |
PROPERTY_FILE |
static String |
SEPARATOR |
static char |
SEPARATOR_CHAR |
| Constructor and Description |
|---|
Weaver(File outputDir,
WeaveConfig config)
Set up the object to manage a weaving process.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close files written by the weaver.
|
byte[] |
finishClassProcess(com.insidious.common.weaver.ClassInfo classInfo,
WeaveLog result)
Write the weaving result to files.
|
void |
log(String message)
Record a message
|
void |
log(Throwable throwable)
Record a runtime error.
|
void |
setDumpEnabled(boolean dump)
Set the bytecode dump option.
|
byte[] |
weave(String container,
String className,
byte[] target,
ClassLoader loader)
Execute bytecode injection for a given class.
|
public static final String PROPERTY_FILE
public static final String SEPARATOR
public static final char SEPARATOR_CHAR
public static final String CLASS_ID_FILE
public static final String METHOD_ID_FILE
public static final String DATA_ID_FILE
public static final String ERROR_LOG_FILE
public static final String CATEGORY_WOVEN_CLASSES
public static final String CATEGORY_ERROR_CLASSES
public Weaver(File outputDir, WeaveConfig config)
outputDir - location to save the weave dataconfig - weave configurationpublic void log(String message)
log in interface IErrorLoggermessage - string to be loggedpublic void log(Throwable throwable)
log in interface IErrorLoggerthrowable - object to be loggedpublic void close()
close in interface IErrorLoggerpublic void setDumpEnabled(boolean dump)
dump - If true is set, the weaver writes the woven class files to the output directory.public byte[] weave(String container, String className, byte[] target, ClassLoader loader)
container - specifies a location (e.g. a Jar file path) where a class is loaded.className - specifies a class file path.target - is the content of the class.loader - is a class loader that loaded the class.public byte[] finishClassProcess(com.insidious.common.weaver.ClassInfo classInfo,
WeaveLog result)
classInfo - records the class information.result - records the state after weaving.Copyright © 2023. All rights reserved.