setup method
Implementation
void setup(List<FieldDescriptor> fields, List<MethodDescriptor>? methods) {
objectType = ObjectType(this);
// super class
if ( superClass != null) {
superClass!.childClasses.add(this);
// inherit fields
for ( var inheritedField in superClass!.getFields()) {
_fields[inheritedField.name] = inheritedField;
}
// inherit methods
for ( var inheritedMethod in superClass!.getMethods()) {
_methods[inheritedMethod.name] = inheritedMethod;
}
}
// own methods
if ( methods != null)
for (var method in methods) {
method.typeDescriptor = this; // marker for a local method
_methods[method.name] = method;
// run annotations
for ( var annotation in method.annotations)
if ( annotation is MethodAnnotation)
annotation.apply(this, method);
} // for
// own fields
for (var field in fields) {
field.typeDescriptor = this; // marker for a local field
_fields[field.name] = field;
// run annotations
for ( var annotation in field.annotations)
if ( annotation is FieldAnnotation)
annotation.apply(this, field);
} // for
// run class annotations
for ( var annotation in annotations)
if ( annotation is ClassAnnotation)
annotation.apply(this);
}