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

Source

This addField(Type fieldType, Str fieldName, Str? getBody := null, Str? setBody := null, Type[] facets := Type[])Type#.emptyList()

Add a field. getBody and setBody are code blocks to be used in the get and set accessors.

addMethod

Source

This addMethod(Type returnType, Str methodName, Str signature, Str body)

Add a method. signature does not include (brackets). body does not include {braces}

className

Source

const Str className

The name of the class.

extendClass

Source

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

Source

This extendMixin(Type mixinType)

Extend the given mixin. The mixin must be public.

isConst

Source

const Bool isConst

Set to true if this class is const

make

Source

new make(Str className, Bool isConst)

Creates a class model with the given name.

mixins

Source

Type[] mixins := Type[,] { private set }

A list of mixin types the model extends.

overrideField

Source

This overrideField(Field field, Str? getBody := null, Str? setBody := null)

Override a field. The given field must exist in a super class / mixin. getBody and setBody are code blocks to be used in the get and set accessors.

overrideMethod

Source

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

Source

Type superClass := sys::Obj# { private set }

The superclass type.

toFantomCode

Source

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

Source

This usingPod(Pod pod)

use the given pod.

usingType

Source

This usingType(Type type)

use the given type.