public void unbind(ValidationObject validationObject)
    {
        Integer id = System.identityHashCode(validationObject);
    	m_unbinding.add(id);
        List<ProposedValue> proposedValues = new ArrayList<ProposedValue>();
    	ProxyObject proxyObject = getSession().getProxyObject(validationObject);
    	for (ProxyField proxyField: proxyObject.getFieldMap().values())
    	{
    		if (!proxyField.isDerived())
    		{
    			// Figure out if this property contains a list or a known object type
    			// we want to ignore those and only reset primitive objects (long, String etc)
    			Class<?> clazz = proxyField.getPropertyMetadata().getGetMethod().getReturnType();
       			if (clazz.isAssignableFrom(List.class))
    			{
    				continue;
    			}
       			if (getSession().getValidationEngine().getClassMetadata(clazz) != null)
    			{
    				continue;
    			}
    			RuleProxyField ruleProxyField = getRuleProxyField(proxyField);
    			if (ruleProxyField.isDifferent(proxyField.getInitialValue()))
    			{
    				ProposedValue pv = new ProposedValue(ruleProxyField,proxyField.getInitialValue());
    				proposedValues.add(pv);
    			}
    		}    		
    	}
        setValues(proposedValues);
        m_boundObjects.remove(id);
    	m_unbinding.remove(id);
        List<String> kill = new ArrayList<String>();
        for (Map.Entry<String, RuleContext> entry: m_ruleContextsMap.entrySet())
        {
        	if (entry.getValue().getValidationObject() == validationObject)
        	{
        		kill.add(entry.getKey());
        	}
        }

        for (String key: kill)
        {
        	RuleContext rc = m_ruleContextsMap.remove(key);
        	rc.reset();
        }
    }
public void unbind ( ValidationObject validationObject ) { Integer id = System . identityHashCode ( validationObject ) ; m_unbinding . add ( id ) ; List < ProposedValue > proposedValues = new ArrayList < ProposedValue > ( ) ; ProxyObject proxyObject = getSession ( ) . getProxyObject ( validationObject ) ; for ( ProxyField proxyField : proxyObject . getFieldMap ( ) . values ( ) ) { if ( ! proxyField . isDerived ( ) ) { Class < ? > clazz = proxyField . getPropertyMetadata ( ) . getGetMethod ( ) . getReturnType ( ) ; if ( clazz . isAssignableFrom ( List . class ) ) { continue ; } if ( getSession ( ) . getValidationEngine ( ) . getClassMetadata ( clazz ) != null ) { continue ; } RuleProxyField ruleProxyField = getRuleProxyField ( proxyField ) ; if ( ruleProxyField . isDifferent ( proxyField . getInitialValue ( ) ) ) { ProposedValue pv = new ProposedValue ( ruleProxyField , proxyField . getInitialValue ( ) ) ; proposedValues . add ( pv ) ; } } } setValues ( proposedValues ) ; m_boundObjects . remove ( id ) ; m_unbinding . remove ( id ) ; List < String > kill = new ArrayList < String > ( ) ; for ( Map . Entry < String , RuleContext > entry : m_ruleContextsMap . entrySet ( ) ) { if ( entry . getValue ( ) . getValidationObject ( ) == validationObject ) { kill . add ( entry . getKey ( ) ) ; } } for ( String key : kill ) { RuleContext rc = m_ruleContextsMap . remove ( key ) ; rc . reset ( ) ; } }
/* (non-Javadoc)
@see nz.co.senanque.rules.RuleSession#bind(nz.co.senanque.validationengine.ValidationObject)