setup method
Implementation
void setup(List<FieldDescriptor> fields, List<MethodDescriptor>? methods) {
objectType = ObjectType<T>();
// super class
if ( superClass != null) {
superClass!.childClasses.add(this);
// inherit properties
for ( var inheritedProperty in superClass!.getProperties()) {
_properties[inheritedProperty.name] = inheritedProperty;
}
}
// own methods
if ( methods != null)
for (var method in methods) {
method.typeDescriptor = this; // marker for a local method
_properties[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
_properties[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);
}