Map<AccessibleObject, Object> state = state();
Association<T> association = (Association<T>) state.get( accessor );
if( association == null )
{
final AssociationModel associationModel = stateModel.getAssociation( accessor );
association = new AssociationInstance<>(
entityState instanceof BuilderEntityState
? associationModel.getBuilderInfo()
: associationModel,
entityFunction,
new Property<EntityReference>()
{
@Override
public EntityReference get()
{
return entityState.associationValueOf( associationModel.qualifiedName() );
}
@Override
public void set( EntityReference newValue )
throws IllegalArgumentException, IllegalStateException
{
entityState.setAssociationValue( associationModel.qualifiedName(), newValue );
}
} );
state.put( accessor, association );
}