1717package network .aika .type ;
1818
1919import network .aika .fields .defs .FieldDefinition ;
20- import network .aika .fields .field .Field ;
2120import network .aika .type .relations .Relation ;
2221import org .slf4j .Logger ;
2322import org .slf4j .LoggerFactory ;
2726import java .util .function .Function ;
2827import java .util .stream .Collectors ;
2928
30- import static network .aika .fields .direction .Direction .INPUT ;
31- import static network .aika .fields .direction .Direction .OUTPUT ;
3229import static network .aika .type .FlattenedType .createInputFlattenedType ;
3330import static network .aika .type .FlattenedType .createOutputFlattenedType ;
3431
3532/**
3633 * @author Lukas Molzberger
3734 */
38- public abstract class Type <T extends Type <T , O >, O extends Obj <T , O >> {
35+ public class Type <T extends Type <T , O >, O extends Obj <T , O >> {
3936
4037 protected static final Logger LOG = LoggerFactory .getLogger (Type .class );
4138
@@ -55,6 +52,8 @@ public abstract class Type<T extends Type<T, O>, O extends Obj<T, O>> {
5552
5653 private final Set <FieldDefinition <T , O >> fieldDefinitions = new HashSet <>();
5754
55+ private final List <Relation <T , O , ?, ?>> relations = new ArrayList <>();
56+
5857 private Integer depth ;
5958
6059 private FlattenedType <T , O , ?, ?> flattenedTypeInputSide ;
@@ -75,7 +74,9 @@ public boolean isAbstract() {
7574 return !children .isEmpty ();
7675 }
7776
78- public abstract <RT extends Type <RT , RO >, RO extends Obj <RT , RO >> Relation <T , O , RT , RO >[] getRelations ();
77+ public <RT extends Type <RT , RO >, RO extends Obj <RT , RO >> Relation <T , O , RT , RO >[] getRelations () {
78+ return relations .toArray (new Relation [0 ]);
79+ }
7980
8081 public void initFlattenedType () {
8182 Set <FieldDefinition <T , O >> fieldDefs = getCollectFlattenedFieldDefinitions ();
@@ -114,7 +115,7 @@ public Integer getDepth() {
114115 return depth ;
115116 }
116117
117- protected O instantiate (List <Class <?>> parameterTypes , List <Object > parameters ) {
118+ public O instantiate (List <Class <?>> parameterTypes , List <Object > parameters ) {
118119 if (isAbstract ())
119120 throw new RuntimeException ("Unable to instantiate abstract type " + name );
120121
0 commit comments