Package ns.foundation

Examples of ns.foundation.NSKeyValueCoding$DefaultImplementation


  }
 
  public void testDefaultImplementation$_keyGetBindingForKey$doubleField() {   
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "doubleObjectField");
    assertEquals(Double.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.doubleObjectField = FORTY_TWO_DOUBLE;
    assertEquals(FORTY_TWO_DOUBLE, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "doubleField");
    assertEquals(Double.class, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.doubleField = FORTY_TWO_DOUBLE;
    assertEquals(FORTY_TWO_DOUBLE, kb.valueInObject(obj));
  }
View Full Code Here


  }

  public void testDefaultImplementation$_keyGetBindingForKey$booleanField() {   
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "booleanObjectField");
    assertEquals(Boolean.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.booleanObjectField = true;
    assertEquals(Boolean.TRUE, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "booleanField");
    assertEquals(Boolean.class, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.booleanField = true;
    assertEquals(Boolean.TRUE, kb.valueInObject(obj));
  }
View Full Code Here

  }

  public void testDefaultImplementation$_keyGetBindingForKey$stringField() {   
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "stringField");
    assertEquals(String.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.stringField = FORTY_TWO_STRING;
    assertEquals(FORTY_TWO_STRING, kb.valueInObject(obj));
  }
View Full Code Here

   */

  public void testDefaultImplementation$_keySetBindingForKey$knownField() {
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keySetBindingForKey(obj, "knownField");
    assertEquals(obj.getClass(), kb.targetClass());
    assertEquals("knownField", kb.key());
    assertEquals(Integer.class, kb.valueType());
  }
View Full Code Here

  }
 
  public void testDefaultImplementation$_keySetBindingForKey$byteField() {
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keySetBindingForKey(obj, "byteObjectField");
    assertEquals(Byte.class, kb.valueType());
    assertFalse(kb.isScalarProperty());

    kb.setValueInObject(FORTY_TWO_BYTE, obj);
    assertEquals(FORTY_TWO_BYTE, obj.byteObjectField);
   
    kb = DefaultImplementation._keySetBindingForKey(obj, "byteField");
    assertEquals(Byte.TYPE, kb.valueType());
    assertTrue(kb.isScalarProperty());

    kb.setValueInObject(FORTY_TWO_BYTE, obj);
    assertEquals(FORTY_TWO_BYTE.byteValue(), obj.byteField);
  }
View Full Code Here

  }
 
  public void testDefaultImplementation$_keySetBindingForKey$integerField() {
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keySetBindingForKey(obj, "integerField");
    assertEquals(Integer.class, kb.valueType());
    assertFalse(kb.isScalarProperty());

    kb.setValueInObject(FORTY_TWO, obj);
    assertEquals(FORTY_TWO, obj.integerField);
   
    kb = DefaultImplementation._keySetBindingForKey(obj, "intField");
    assertEquals(Integer.class, kb.valueType());
    assertTrue(kb.isScalarProperty());

    kb.setValueInObject(FORTY_TWO, obj);
    assertEquals(FORTY_TWO.intValue(), obj.intField);
  }
View Full Code Here

  }
 
  public void testDefaultImplementation$_keySetBindingForKey$longObjectField() {
    KeyBindingTypeTest obj = new KeyBindingTypeTest();

    _KeyBinding kb = DefaultImplementation._keySetBindingForKey(obj, "longObjectField");
    assertEquals(Long.class, kb.valueType());
    assertFalse(kb.isScalarProperty());

    kb.setValueInObject(FORTY_TWO_LONG, obj);
    assertEquals(FORTY_TWO_LONG, obj.longObjectField);
   
    kb = DefaultImplementation._keySetBindingForKey(obj, "longField");
    assertEquals(Long.class, kb.valueType());
    assertTrue(kb.isScalarProperty());

    kb.setValueInObject(FORTY_TWO_LONG, obj);
    assertEquals(FORTY_TWO_LONG.longValue(), obj.longField);
  }
View Full Code Here

    Utility.takeValueForKey(obj, FORTY_TWO, "anyKey");
    assertEquals(FORTY_TWO, obj.value());
  }
   
  public void testUtility$takeValueForKey$implementsKeyBindingCreation() {
    _KeyBindingCreation obj = new _KeyBindingCreation() {
      private Object _value;
     
      @Override
      public _KeyBinding _keySetBindingForKey(String s) {
        return new _KeyBinding(Object.class, "knownKey") {
View Full Code Here

    Utility.takeValueForKey(obj, FORTY_TWO, "knownKey");
    assertEquals(FORTY_TWO, Utility.valueForKey(obj, "knownKey"));
  }
 
  public void testUtility$takeValueForKey$implementsCallBack() {
    Callback obj = new Callback() {
      private Object _value;
     
      public Object field;
      public Object method() { return null; }
      public void setMethod(Object obj) { }
View Full Code Here

    boolean canAccessFieldsDirectlyTestPerformed = false;
    boolean canAccessFieldsDirectly = false;

    // we use a KeyBinding as key for the _BindingStorage object map table since it gives us exactly what we need: a class and a key - but we have to create a new lookup key binding to avoid synchronizing the read lookup (and we need a new instance for the write access)
    NSKeyValueCoding._KeyBinding lookupBinding = new NSKeyValueCoding._KeyBinding(objectClass, key);
    _BindingStorage bindingStorage = _bindingStorageMapTable.get(lookupBinding);
    if (bindingStorage == null) {
      bindingStorage = new _KeyBindingFactory._BindingStorage();
      _bindingStorageMapTable.put(lookupBinding, bindingStorage);
    }
View Full Code Here

TOP

Related Classes of ns.foundation.NSKeyValueCoding$DefaultImplementation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.