protected KeyValueInstance(InspectableObject inspectable, String keyPath) { _inspectable = inspectable; _keyPath = keyPath; _value = KVUtil.getValueForKey(inspectable, keyPath); _propModel = null; /*System.out.println("Inspectable: "+inspectable); System.out.println("keyPath: "+keyPath); System.out.println("_value: "+_value);*/ }
public Object getValueForKey(String aKeyPath) { if (_value == null) { return null; } if (_value instanceof KeyValueCoding) { return KVUtil.getValueForKey((KeyValueCoding) _value, aKeyPath); } logger.warning("Could not access " + aKeyPath + " for " + _value); return null; }
private boolean evaluate(Expression expression, InspectableObject object) { Vector<KeyValueInstance> parameters = new Vector<KeyValueInstance>(); for (Enumeration en = _dependsProperties.elements(); en.hasMoreElements(); ) { String nextProperty = (String) en.nextElement(); if (KVUtil.hasValueForKey(object, nextProperty)) { // Current inspected object might not have this property, ignore it then parameters.add(new KeyValueInstance(object, nextProperty)); } // System.out.println("Add param for "+nextProperty); } boolean returned = evaluate(expression, parameters); if (logger.isLoggable(Level.FINE)) { logger.fine("Evaluate " + expression + " : returns " + returned); } return returned; }