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.
- addCtor
This addCtor(Str ctorName, Str signature, Str body)Add a ctor.
signaturedoes not include (brackets).bodydoes not include {braces}- addField
This addField(Type fieldType, Str fieldName, Str? getBody := null, Str? setBody := null, Type[] facets := Type[])Type#.emptyList()Add a field.
getBodyandsetBodyare code blocks to be used in thegetandsetaccessors.- addMethod
This addMethod(Type returnType, Str methodName, Str signature, Str body)Add a method.
signaturedoes not include (brackets).bodydoes not include {braces}- className
const Str classNameThe 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 isConstSet to
trueif 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.
getBodyandsetBodyare code blocks to be used in thegetandsetaccessors.- overrideMethod
This overrideMethod(Method method, Str body)Add a method. The given method must exist in a super class / mixin.
bodydoes 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
usethe given pod.- usingType
usethe given type.