public static class ERXQuery.Record extends Object implements com.webobjects.foundation.NSKeyValueCoding, com.webobjects.foundation.NSKeyValueCodingAdditions
String name = ""; C c = null; Object value = rec.objectForKey("a.b.c"); if (value != NSKeyValueCoding.NullValue) { c = (C) value; name = (String) c.valueForKeyPath("x.y.name"); }you can use regular valueForKeyPath() like this:
String name = (String) rec.valueForKeyPath("a.b.c.x.y.name");Values of NSKeyValueCoding.NullValue are automatically translated to null and you can use the valueForKeyPathWithDefault() method to translate null to a default value and get rid of casting the value like this:
String name = rec.valueForKeyPathWithDefault("a.b.c.x.y.name", "");
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.MapImplementation, com.webobjects.foundation.NSKeyValueCoding.Null<T>, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
Constructor and Description |
---|
Record(com.webobjects.eocontrol.EOEditingContext context,
NSMutableDictionary<String,Object> row) |
Modifier and Type | Method and Description |
---|---|
void |
takeValueForKey(Object value,
String key) |
void |
takeValueForKeyPath(Object value,
String keyPath) |
String |
toString() |
Object |
valueForKey(String key) |
Object |
valueForKeyPath(String keyPath) |
<V> V |
valueForKeyPathWithDefault(String keyPath,
V defaultValue) |
public Record(com.webobjects.eocontrol.EOEditingContext context, NSMutableDictionary<String,Object> row)
public void takeValueForKey(Object value, String key)
takeValueForKey
in interface com.webobjects.foundation.NSKeyValueCoding
public Object valueForKey(String key)
valueForKey
in interface com.webobjects.foundation.NSKeyValueCoding
public void takeValueForKeyPath(Object value, String keyPath)
takeValueForKeyPath
in interface com.webobjects.foundation.NSKeyValueCodingAdditions
public Object valueForKeyPath(String keyPath)
valueForKeyPath
in interface com.webobjects.foundation.NSKeyValueCodingAdditions
public <V> V valueForKeyPathWithDefault(String keyPath, V defaultValue)
Copyright © 2002 – 2020 Project Wonder.