Package ns.foundation

Examples of ns.foundation.NSKeyValueCoding$_KeyBinding


      return _delegate.toString();
    }
  }
 
  public static _KeyBinding _createKeyBindingForKey(Object object, String key, int lookupOrder[], boolean trueForSetAndFalseForGet) {
    _KeyBinding keyBinding = new _NSPropertyAccessor(object)._createKeyBindingForKey(key, lookupOrder, trueForSetAndFalseForGet);
    return keyBinding == null ? null : new _LegacyCompatibleKeyBinding(keyBinding);
  }
View Full Code Here


      int lookup = lookupOrder[i];
      NSKeyValueCoding._KeyBinding keyBinding = ((lookup >= _KeyBindingFactory.MethodLookup) && (lookup <= _KeyBindingFactory.UnderbarFieldLookup)) ? keyBindings[lookup] : null;
      if (keyBinding == null) {
        Class<?> valueType = null;
        if (trueForSetAndFalseForGet) {
          _KeyBinding getKeyBinding = _createKeyBindingForKey(key, lookupOrder, false);
          valueType = getKeyBinding != null ? getKeyBinding.valueType() : null;
        }

        switch (lookup) {
          case _KeyBindingFactory.MethodLookup:
            String methodName = prefixedKey((trueForSetAndFalseForGet) ? "set" : "get", key);
View Full Code Here

      wrapper.addMethod(setter);
      _addMethodsForValueType(wrapper, valueType, valueType.isPrimitive());
     
      @SuppressWarnings("unchecked")
      Class<_KeyBinding> wrapperClass = wrapper.toClass(classLoader, getClass().getProtectionDomain());
      _KeyBinding binding = wrapperClass.newInstance();
      return binding;
    } catch (NotFoundException e) {
      return null;
    } catch (Exception e) {
      throw new NSForwardException(e);
View Full Code Here

      wrapper.addMethod(getter);
      _addMethodsForValueType(wrapper, valueType, false);

      @SuppressWarnings("unchecked")
      Class<_KeyBinding> wrapperClass = wrapper.toClass(classLoader, getClass().getProtectionDomain());
      _KeyBinding binding = wrapperClass.newInstance();
      return binding;
    } catch (NotFoundException e) {
      return null;
    } catch (Exception e) {
      throw new NSForwardException(e);
View Full Code Here

  }

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

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "floatObjectField");
    assertEquals(Float.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.floatObjectField = FORTY_TWO_FLOAT;
    assertEquals(FORTY_TWO_FLOAT, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "floatField");
    assertEquals(Float.class, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.floatField = FORTY_TWO_FLOAT;
    assertEquals(FORTY_TWO_FLOAT, kb.valueInObject(obj));
  }
View Full Code Here

      wrapper.addMethod(setter);
      _addMethodsForValueType(wrapper, valueType, valueType.isPrimitive());
     
      @SuppressWarnings("unchecked")
      Class<_KeyBinding> wrapperClass = wrapper.toClass(classLoader, getClass().getProtectionDomain());
      _KeyBinding binding = wrapperClass.newInstance();
      return binding;
    } catch (NotFoundException e) {
      return null;
    } catch (Exception e) {
      throw new NSForwardException(e);
View Full Code Here

  }
 
  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

TOP

Related Classes of ns.foundation.NSKeyValueCoding$_KeyBinding

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.