Package com.sun.xml.bind.v2.bytecode
Class ClassTailor
- java.lang.Object
-
- com.sun.xml.bind.v2.bytecode.ClassTailor
-
public final class ClassTailor extends Object
Replaces a few constant pool tokens from a class "template" and then loads it into the VM.- Author:
- Kohsuke Kawaguchi
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
tailor(InputStream image, String templateClassName, String newClassName, String... replacements)
Customizes a class file by replacing constant pools.static byte[]
tailor(Class templateClass, String newClassName, String... replacements)
static String
toVMClassName(Class c)
Returns the class name in the JVM format (such as "java/lang/String")static String
toVMTypeName(Class c)
-
-
-
Method Detail
-
toVMClassName
public static String toVMClassName(Class c)
Returns the class name in the JVM format (such as "java/lang/String")
-
tailor
public static byte[] tailor(Class templateClass, String newClassName, String... replacements)
-
tailor
public static byte[] tailor(InputStream image, String templateClassName, String newClassName, String... replacements)
Customizes a class file by replacing constant pools.- Parameters:
image
- The image of the template class.replacements
- A list of pair of strings that specify the substitutionString[]{search_0, replace_0, search_1, replace_1, ..., search_n, replace_n }
The search strings found in the constant pool will be replaced by the corresponding replacement string.
-
-