Interface ClassOutput
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A container for created classes with a specific output strategy.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ClassOutputandThen(ClassOutput next) Returns a class output that write the class bytes to this output as well as the given one.static ClassOutputReturns a class output that discards its inputs.static ClassOutputfileWriter(Path basePath) Returns a class output for the given path.default voidregisterBootstrapMethod(ClassDesc owner, String name, MethodTypeDesc type) Register a newly created bootstrap method.default voidAccept and write the class bytes.voidWrite a resource to the output.
-
Method Details
-
write
Accept and write the class bytes.- Parameters:
desc- the class descriptor (notnull)bytes- the class file bytes (notnull)
-
registerBootstrapMethod
Register a newly created bootstrap method. This can be used to register the method with a native image generator such as GraalVM. The first three argument types of the method type descriptor must be:ConstantDescs.CD_MethodHandles_Lookup(for the lookup to use)ConstantDescs.CD_String(for the constant name)- either
ConstantDescs.CD_Class(for dynamic constants) orConstantDescs.CD_MethodType(forinvokedynamiccall sites)
invokedynamicbootstrap, its return type must beConstantDescs.CD_CallSite. The default implementation does nothing.- Parameters:
owner- the owner of the bootstrap method (must not benull)name- the bootstrap method name (must not benull)type- the bootstrap method type (must not benull)
-
write
Write a resource to the output.- Parameters:
path- the resource relative path (notnull)bytes- the resource bytes (notnull)
-
andThen
Returns a class output that write the class bytes to this output as well as the given one.- Parameters:
next- the other class output to write to (must not benull)- Returns:
- a class output that write the class bytes to this output as well as the given one
-
fileWriter
Returns a class output for the given path.- Parameters:
basePath- the path into which class files should be stored (must not benull)- Returns:
- a class output for the given path
-
discarding
Returns a class output that discards its inputs.- Returns:
- a class output that discards its inputs
-