Examples of PropertyReference


Examples of org.auraframework.expression.PropertyReference

        bvp.validate(BrowserProperty.isIPad);
        bvp.validate(BrowserProperty.isIPhone);
        bvp.validate(BrowserProperty.isIOS);
        bvp.validate(BrowserProperty.isWindowsPhone);

        PropertyReference property = new PropertyReferenceImpl("hah", null);
        try {
            bvp.validate(property);
            fail("Expected InvalidExpressionException for " + property);
        } catch (InvalidExpressionException e) {
            assertEquals("No property on $Browser for key: " + property,
View Full Code Here

Examples of org.auraframework.expression.PropertyReference

        LocaleValueProvider lvp = new LocaleValueProvider();
        for (LocaleProperty lp : LocaleProperty.values()) {
            lvp.validate(lp.getRef());
        }

        PropertyReference property = new PropertyReferenceImpl("badProperty", null);
        try {
            lvp.validate(property);
            fail("Expected InvalidExpressionException for " + property);
        } catch (InvalidExpressionException e) {
            assertEquals("No property on $Locale for key: " + property,
View Full Code Here

Examples of org.auraframework.expression.PropertyReference

     * Property references can have multiple parts.
     */
    public void testPropertyReference() throws Exception {
        Expression e = buildExpression("im");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        PropertyReference pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.parsing");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReferenceImpl) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "parsing", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.not.nullish");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReferenceImpl) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "not", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming twice", "nullish", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("_i.am_very._.readable_");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReferenceImpl) e;
        assertEquals("Unexpected root of PropertyReference", "_i", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "am_very", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming twice", "_", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming thrice", "readable_", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());
    }
View Full Code Here

Examples of org.auraframework.expression.PropertyReference

     * Property references can access array members
     */
    public void testArrayAccessors() throws Exception {
        Expression e = buildExpression("im[0]");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        PropertyReference pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference", "0", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.an[3151345]");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.an[3151345].array");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming and accessing array", "array", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("multi[1][364]");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "multi", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference", "1", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access second array member via PropertyReference", "364", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());
    }
View Full Code Here

Examples of org.chromium.sdk.internal.v8native.value.PropertyReference

    if (receiverVariableRef.get() != null) {
      return;
    }
    JsVariable result;

    PropertyReference ref = V8Helper.computeReceiverRef(frameObject);
    if (ref == null) {
      result = null;
    } else {
      ValueLoader valueLoader = context.getValueLoader();
      ValueMirror mirror =
          valueLoader.getOrLoadValueFromRefs(Collections.singletonList(ref)).get(0);
      // This name should be string. We are making it string as a fall-back strategy.
      String varNameStr = ref.getName().toString();
      // 'this' variable is not mutable. Consider making it mutable.
      result = new JsVariableBase.Impl(valueLoader, mirror, varNameStr);
    }
    if (result != null) {
      receiverVariableRef.compareAndSet(null, result);
View Full Code Here

Examples of org.chromium.sdk.internal.v8native.value.PropertyReference

    };
  }

  public static <OBJ> void putMirror(List<PropertyReference> refs, OBJ propertyObject,
      V8ProtocolUtil.PropertyNameGetter<OBJ> nameGetter) {
    PropertyReference propertyRef = V8ProtocolUtil.extractProperty(propertyObject, nameGetter);
    if (propertyRef != null) {
      refs.add(propertyRef);
    }
  }
View Full Code Here

Examples of org.chromium.sdk.internal.v8native.value.PropertyReference

        : PropertyType.NORMAL.value;
    if (propTypeValue == PropertyType.FIELD.value ||
        propTypeValue == PropertyType.CONSTANT_FUNCTION.value ||
        propTypeValue == PropertyType.CALLBACKS.value ||
        propTypeValue == PropertyType.NORMAL.value) {
      return new PropertyReference(name, propValue);
    }
    return null;
  }
View Full Code Here

Examples of org.chromium.sdk.internal.v8native.value.PropertyReference

    if (receiverVariableRef.get() != null) {
      return;
    }
    JsVariable result;

    PropertyReference ref = V8Helper.computeReceiverRef(frameObject);
    if (ref == null) {
      result = null;
    } else {
      ValueLoader valueLoader = context.getValueLoader();
      ValueMirror mirror =
          valueLoader.getOrLoadValueFromRefs(Collections.singletonList(ref)).get(0);
      // This name should be string. We are making it string as a fall-back strategy.
      String varNameStr = ref.getName().toString();
      result = new JsVariableImpl(valueLoader, mirror, varNameStr);
    }
    if (result != null) {
      receiverVariableRef.compareAndSet(null, result);
    }
View Full Code Here

Examples of org.chromium.sdk.internal.v8native.value.PropertyReference

    };
  }

  public static <OBJ> void putMirror(List<PropertyReference> refs, OBJ propertyObject,
      V8ProtocolUtil.PropertyNameGetter<OBJ> nameGetter) {
    PropertyReference propertyRef = V8ProtocolUtil.extractProperty(propertyObject, nameGetter);
    if (propertyRef != null) {
      refs.add(propertyRef);
    }
  }
View Full Code Here

Examples of org.chromium.sdk.internal.v8native.value.PropertyReference

        : PropertyType.NORMAL.value;
    if (propTypeValue == PropertyType.FIELD.value ||
        propTypeValue == PropertyType.CONSTANT_FUNCTION.value ||
        propTypeValue == PropertyType.CALLBACKS.value ||
        propTypeValue == PropertyType.NORMAL.value) {
      return new PropertyReference(name, propValue);
    }
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.