Package ns.foundation.NSKeyValueCoding._KeyBindingCreation._KeyBindingFactory

Examples of ns.foundation.NSKeyValueCoding._KeyBindingCreation._KeyBindingFactory.Callback


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

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "charObjectField");
    assertEquals(Character.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.charObjectField = FORTY_TWO_CHAR;
    assertEquals(FORTY_TWO_CHAR, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "charField");
    assertEquals(Character.TYPE, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.charField = FORTY_TWO_CHAR;
    assertEquals(FORTY_TWO_CHAR, kb.valueInObject(obj));
  }
View Full Code Here


  }

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

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "shortObjectField");
    assertEquals(Short.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.shortObjectField = FORTY_TWO_SHORT;
    assertEquals(FORTY_TWO_SHORT, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "shortField");
    assertEquals(Short.class, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.shortField = FORTY_TWO_SHORT;
    assertEquals(FORTY_TWO_SHORT, kb.valueInObject(obj));
  }
View Full Code Here

  }

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

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "integerField");
    assertEquals(Integer.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.integerField = FORTY_TWO;
    assertEquals(FORTY_TWO, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "intField");
    assertEquals(Integer.class, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.intField = FORTY_TWO;
    assertEquals(FORTY_TWO, kb.valueInObject(obj));
  }
View Full Code Here

  }

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

    _KeyBinding kb = DefaultImplementation._keyGetBindingForKey(obj, "longObjectField");
    assertEquals(Long.class, kb.valueType());
    assertFalse(kb.isScalarProperty());
    obj.longObjectField = FORTY_TWO_LONG;
    assertEquals(FORTY_TWO_LONG, kb.valueInObject(obj));
   
    kb = DefaultImplementation._keyGetBindingForKey(obj, "longField");
    assertEquals(Long.class, kb.valueType());
    assertTrue(kb.isScalarProperty());
    obj.longField = FORTY_TWO_LONG;
    assertEquals(FORTY_TWO_LONG, kb.valueInObject(obj));
  }
View Full Code Here

      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

TOP

Related Classes of ns.foundation.NSKeyValueCoding._KeyBindingCreation._KeyBindingFactory.Callback

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.