public static class ERXQuery.Record extends Object implements NSKeyValueCoding, 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", "");
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
Constructor and Description |
---|
Record(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(EOEditingContext context, NSMutableDictionary<String,Object> row)
public void takeValueForKey(Object value, String key)
takeValueForKey
in interface NSKeyValueCoding
public Object valueForKey(String key)
valueForKey
in interface NSKeyValueCoding
public void takeValueForKeyPath(Object value, String keyPath)
takeValueForKeyPath
in interface NSKeyValueCodingAdditions
public Object valueForKeyPath(String keyPath)
valueForKeyPath
in interface NSKeyValueCodingAdditions
public <V> V valueForKeyPathWithDefault(String keyPath, V defaultValue)
Copyright © 2002 – 2024 Project Wonder.