| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
H2JVM.Builder
Description
Provides a monadic interface for building class files in a high-level format.
Synopsis
- data ClassBuilder (m :: k) a
- addAccessFlag :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassAccessFlag -> Eff r ()
- setName :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => QualifiedClassName -> Eff r ()
- getName :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => Eff r QualifiedClassName
- setVersion :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => JVMVersion -> Eff r ()
- setSuperClass :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => QualifiedClassName -> Eff r ()
- addInterface :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => QualifiedClassName -> Eff r ()
- addField :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassFileField -> Eff r ()
- addMethod :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassFileMethod -> Eff r ()
- addMethodWithCode :: forall (r :: [Effect]) a. ((ClassBuilder :: (Type -> Type) -> Type -> Type) :> r, Error StackMapError :> r, HasCallStack) => Text -> [MethodAccessFlag] -> MethodDescriptor -> Eff ((CodeBuilder :: (Type -> Type) -> Type -> Type) ': r) a -> Eff r a
- addMethodWithCode_ :: forall (r :: [Effect]) a. ((ClassBuilder :: (Type -> Type) -> Type -> Type) :> r, Error StackMapError :> r, HasCallStack) => Text -> [MethodAccessFlag] -> MethodDescriptor -> Eff ((CodeBuilder :: (Type -> Type) -> Type -> Type) ': r) a -> Eff r ()
- addAttribute :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassFileAttribute -> Eff r ()
- addBootstrapMethod :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => BootstrapMethod -> Eff r ()
- runClassBuilder :: forall (r :: [(Type -> Type) -> Type -> Type]) a. QualifiedClassName -> JVMVersion -> Eff ((ClassBuilder :: (Type -> Type) -> Type -> Type) ': r) a -> Eff r (ClassFile, a)
Documentation
data ClassBuilder (m :: k) a Source #
The class builder effect for constructing a ClassFile statefully.
Instances
| type DispatchOf (ClassBuilder :: (Type -> Type) -> Type -> Type) Source # | |
Defined in H2JVM.Builder | |
addAccessFlag :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassAccessFlag -> Eff r () Source #
Add an access flag modifier to the class being built.
setName :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => QualifiedClassName -> Eff r () Source #
Set the fully qualified name of the class being built.
getName :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => Eff r QualifiedClassName Source #
Retrieve the current fully qualified name of the class being built.
setVersion :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => JVMVersion -> Eff r () Source #
Set the target JVM version of the class being built.
setSuperClass :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => QualifiedClassName -> Eff r () Source #
Set the superclass name of the class being built.
addInterface :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => QualifiedClassName -> Eff r () Source #
Add an implemented interface to the class being built.
addField :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassFileField -> Eff r () Source #
Add a field definition to the class being built.
addMethod :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassFileMethod -> Eff r () Source #
Add a method definition to the class being built.
addMethodWithCode :: forall (r :: [Effect]) a. ((ClassBuilder :: (Type -> Type) -> Type -> Type) :> r, Error StackMapError :> r, HasCallStack) => Text -> [MethodAccessFlag] -> MethodDescriptor -> Eff ((CodeBuilder :: (Type -> Type) -> Type -> Type) ': r) a -> Eff r a Source #
Add a method definition to the class being built, whose body is the result of some CodeBuilder monad.
This is essentially a convenience function to:
1. Run the CodeBuilder
2. Calculate the StackMapTable etc.
3. Setup the ClassFileMethod and CodeAttributeData
4. Add the method to this ClassBuilder.
addMethodWithCode_ :: forall (r :: [Effect]) a. ((ClassBuilder :: (Type -> Type) -> Type -> Type) :> r, Error StackMapError :> r, HasCallStack) => Text -> [MethodAccessFlag] -> MethodDescriptor -> Eff ((CodeBuilder :: (Type -> Type) -> Type -> Type) ': r) a -> Eff r () Source #
Like addMethodWithCode, but ignoring the result of the function.
addAttribute :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => ClassFileAttribute -> Eff r () Source #
Add a class file attribute to the class being built.
addBootstrapMethod :: forall (r :: [Effect]). (ClassBuilder :: (Type -> Type) -> Type -> Type) :> r => BootstrapMethod -> Eff r () Source #
Add a bootstrap method for invokedynamic calls.
runClassBuilder :: forall (r :: [(Type -> Type) -> Type -> Type]) a. QualifiedClassName -> JVMVersion -> Eff ((ClassBuilder :: (Type -> Type) -> Type -> Type) ': r) a -> Eff r (ClassFile, a) Source #