classafPlastic::PlasticClassModel

sys::Obj
  afPlastic::PlasticClassModel

Models a Fantom class.

If not defined already, types are generated with a standard it-block 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

Source

PlasticCtorModel addCtor(Str ctorName, Str signature, Str body, Str? superCtor := null)

Add a ctor.

signature does not include (brackets).

body does not include {braces}

superCtor is the entire expression, super.make(in)

addFacet

Source

PlasticFacetModel addFacet(Type type, Str:Str params := [:])

addFacetClone

Source

This addFacetClone(Facet toClone)

addField

Source

PlasticFieldModel addField(Type fieldType, Str fieldName, Str? getBody := null, Str? setBody := null)

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

addMethod

Source

PlasticMethodModel 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.

ctors

Source

PlasticCtorModel[] ctors { private set }

extend

Source

This extend(Type type)

Extends the given type; be it a class or a mixin.

If type is a class, it is set as the superclass, if it is a mixin, it is extended.

If this model is const, then the given type must be const also.

The type must be public.

facets

Source

PlasticFacetModel[] facets { private set }

fields

Source

PlasticFieldModel[] fields { private set }

hasField

Source

Bool hasField(Str name)

Returns true if this model has a field with the given name.

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.

methods

Source

PlasticMethodModel[] methods { private set }

mixins

Source

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

A list of mixin types the model extends.

overrideCtor

Source

PlasticCtorModel overrideCtor(Method ctor, Str body)

Override a ctor The given ctor method must exist in a super class / mixin. body does not include {braces}

overrideField

Source

PlasticFieldModel 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

PlasticMethodModel overrideMethod(Method method, Str body)

Override 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.

usingStr

Source

This usingStr(Str usingStr)

use the given Str, should not start with using.

usingType

Source

This usingType(Type type, Str? usingAs := null)

use the given type.

usings

Source

PlasticUsingModel[] usings { private set }