public DynamicType < RelationTypeMetadata < RelationMetadata > > getRelationTypes ( Set < EntityDiscriminator > sourceDiscriminators , RelationDiscriminator discriminator , Set < EntityDiscriminator > targetDiscriminators ) { DynamicType < RelationTypeMetadata < RelationMetadata >> dynamicType = new DynamicType <> ( ) ; Set < RelationMapping < EntityDiscriminator , RelationMetadata , RelationDiscriminator > > relations = relationMappings . get ( discriminator ) ; if ( relations != null ) { Set < RelationTypeMetadata < RelationMetadata >> relationTypes = new HashSet <> ( ) ; for ( RelationMapping < EntityDiscriminator , RelationMetadata , RelationDiscriminator > relation : relations ) { Set < EntityDiscriminator > source = relation . getSource ( ) ; Set < EntityDiscriminator > target = relation . getTarget ( ) ; if ( sourceDiscriminators . containsAll ( source ) && targetDiscriminators . containsAll ( target ) ) { RelationTypeMetadata < RelationMetadata > relationType = relation . getRelationType ( ) ; relationTypes . add ( relationType ) ; } } dynamicType = new DynamicType <> ( relationTypes ) ; } return dynamicType ; }
Determine the relation type for the given source discriminators relation descriminator and target discriminators .