classafPlastic::PlasticClassModel
sys::Obj afPlastic::PlasticClassModel
Models a Fantom class.
All types are generated with a standard serialisation ctor:
new make(|This|? f := null) { f?.call(this) }
All added fields and methods will be public. As you will never compile against the generated code, this should not be problematic.
- addField
This addField(Type fieldType, Str fieldName, Str? getBody := null, Str? setBody := null, Type[] facets := Type[])Type#.emptyList()
Add a field.
getBody
andsetBody
are code blocks to be used in theget
andset
accessors.- addMethod
This addMethod(Type returnType, Str methodName, Str signature, Str body)
Add a method.
signature
does not include (brackets).body
does not include {braces}- className
const Str className
The name of the class.
- extendClass
This extendClass(Type classType)
Sets the given type as the superclass. If this model is const, then the given type must be const also. This method may only be called once. The superclass must be an acutal
class
(not a mixin) and be public.- extendMixin
This extendMixin(Type mixinType)
Extend the given mixin. The mixin must be public.
- isConst
const Bool isConst
Set to
true
if this class isconst
- make
new make(Str className, Bool isConst)
Creates a class model with the given name.
- mixins
Type[] mixins := Type[,] { private set }
A list of mixin types the model extends.
- overrideField
This overrideField(Field field, Str? getBody := null, Str? setBody := null)
Override a field. The given field must exist in a super class / mixin.
getBody
andsetBody
are code blocks to be used in theget
andset
accessors.- overrideMethod
This overrideMethod(Method method, Str body)
Add a method. The given method must exist in a super class / mixin.
body
does not include {braces}- superClass
Type superClass := sys::Obj# { private set }
The superclass type.
- toFantomCode
Str toFantomCode()
Converts the model into Fantom source code.
All types are generated with a standard serialisation ctor:
new make(|This|? f := null) { f?.call(this) }
- usingPod
use
the given pod.- usingType
use
the given type.