public void setBindsTo ( BindingFeature bindsTo ) { //Check if we need to update if ( this . bindsTo != bindsTo ) { //ok go ahead - first get a pointer to the old binds to as we will swap this soon. BindingFeature old = this . bindsTo ; //swap it this . bindsTo = bindsTo ; //make sure old feature no longer points to this if ( old != null && old . getBindsTo ( ) == this ) { old . setBindsTo ( null ) ; } //make sure new feature points to this if ( ! ( this . bindsTo == null || this . bindsTo . getBindsTo ( ) == this ) ) { this . bindsTo . setBindsTo ( this ) ; } } }
This method will set the paired binding feature that binds to this feature . This method will preserve the symmetric bidirectional semantics . If not - null old feature s bindsTo will be set to null and if not null new feature s binds to will set to this