protected AssociationValue createInstance ( ) { Map < String , Attribute < ? > > attributes = new HashMap < String , Attribute < ? > > ( ) ; for ( AbstractAttributeInfo attrInfo : featureInfo . getAttributes ( ) ) { if ( attrInfo instanceof PrimitiveAttributeInfo ) { attributes . put ( attrInfo . getName ( ) , AttributeUtil . createEmptyPrimitiveAttribute ( ( PrimitiveAttributeInfo ) attrInfo ) ) ; } else if ( attrInfo instanceof AssociationAttributeInfo ) { AssociationAttributeInfo assocInfo = ( AssociationAttributeInfo ) attrInfo ; switch ( assocInfo . getType ( ) ) { case MANY_TO_ONE : attributes . put ( assocInfo . getName ( ) , new ManyToOneAttribute ( ) ) ; break ; case ONE_TO_MANY : OneToManyAttribute oneToMany = new OneToManyAttribute ( ) ; oneToMany . setValue ( new ArrayList < AssociationValue > ( ) ) ; attributes . put ( assocInfo . getName ( ) , oneToMany ) ; break ; default : throw new IllegalStateException ( "Don't know how to handle association type " + assocInfo . getType ( ) ) ; } } } AssociationValue value = new AssociationValue ( ) ; value . setAllAttributes ( attributes ) ; value . setId ( AttributeUtil . createEmptyPrimitiveAttribute ( featureInfo . getIdentifier ( ) ) ) ; return value ; }
Create association attribute for value .