java.beans.Expression Java Examples

The following examples show how to use java.beans.Expression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Test4679556.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            C c = (C) oldInstance;
            return new Expression(c, c.getX(), "createC", new Object[] {});
        }
    });
}
 
Example #2
Source File: TestEncoder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeExpression(Expression expression) {
    if (this.expression == null) {
        this.expression = expression;
    }
    super.writeExpression(expression);
}
 
Example #3
Source File: Test6707226.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Object value = new Object();

    Expression expression = new Expression(value, Object.class, "new", null);
    if (!value.equals(expression.getValue()))
        throw new Error("the value is updated unexpectedly");

    expression.execute();
    if (value.equals(expression.getValue()))
        throw new Error("the value is not updated as expected");
}
 
Example #4
Source File: TestEncoder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeExpression(Expression expression) {
    if (this.expression == null) {
        this.expression = expression;
    }
    super.writeExpression(expression);
}
 
Example #5
Source File: Test5023552.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #6
Source File: Test5023552.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #7
Source File: Test4936682.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(
            OuterClass.InnerClass.class,
            new DefaultPersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance;
                    OuterClass outer = inner.getOuter();
                    return new Expression(inner, outer, "getInner", new Object[0]);
                }
            }
    );
}
 
Example #8
Source File: Test4679556.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            C c = (C) oldInstance;
            return new Expression(c, c.getX(), "createC", new Object[] {});
        }
    });
}
 
Example #9
Source File: Test4679556.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            C c = (C) oldInstance;
            return new Expression(c, c.getX(), "createC", new Object[] {});
        }
    });
}
 
Example #10
Source File: Test6707226.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Object value = new Object();

    Expression expression = new Expression(value, Object.class, "new", null);
    if (!value.equals(expression.getValue()))
        throw new Error("the value is updated unexpectedly");

    expression.execute();
    if (value.equals(expression.getValue()))
        throw new Error("the value is not updated as expected");
}
 
Example #11
Source File: Test5023552.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #12
Source File: TestEncoder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeExpression(Expression expression) {
    if (this.expression == null) {
        this.expression = expression;
    }
    super.writeExpression(expression);
}
 
Example #13
Source File: ObjectElementHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the value of this element.
 *
 * @param type  the base class
 * @param args  the array of arguments
 * @return the value of this element
 * @throws Exception if calculation is failed
 */
@Override
protected final ValueObject getValueObject(Class<?> type, Object[] args) throws Exception {
    if (this.field != null) {
        return ValueObjectImpl.create(FieldElementHandler.getFieldValue(getContextBean(), this.field));
    }
    if (this.idref != null) {
        return ValueObjectImpl.create(getVariable(this.idref));
    }
    Object bean = getContextBean();
    String name;
    if (this.index != null) {
        name = (args.length == 2)
                ? PropertyElementHandler.SETTER
                : PropertyElementHandler.GETTER;
    } else if (this.property != null) {
        name = (args.length == 1)
                ? PropertyElementHandler.SETTER
                : PropertyElementHandler.GETTER;

        if (0 < this.property.length()) {
            name += this.property.substring(0, 1).toUpperCase(ENGLISH) + this.property.substring(1);
        }
    } else {
        name = (this.method != null) && (0 < this.method.length())
                ? this.method
                : "new"; // NON-NLS: the constructor marker
    }
    Expression expression = new Expression(bean, name, args);
    return ValueObjectImpl.create(expression.getValue());
}
 
Example #14
Source File: Test4936682.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(
            OuterClass.InnerClass.class,
            new DefaultPersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance;
                    OuterClass outer = inner.getOuter();
                    return new Expression(inner, outer, "getInner", new Object[0]);
                }
            }
    );
}
 
Example #15
Source File: Test5023552.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #16
Source File: Test4679556.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            C c = (C) oldInstance;
            return new Expression(c, c.getX(), "createC", new Object[] {});
        }
    });
}
 
Example #17
Source File: TestEncoder.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeExpression(Expression expression) {
    if (this.expression == null) {
        this.expression = expression;
    }
    super.writeExpression(expression);
}
 
Example #18
Source File: Test6707226.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Object value = new Object();

    Expression expression = new Expression(value, Object.class, "new", null);
    if (!value.equals(expression.getValue()))
        throw new Error("the value is updated unexpectedly");

    expression.execute();
    if (value.equals(expression.getValue()))
        throw new Error("the value is not updated as expected");
}
 
Example #19
Source File: ObjectElementHandler.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the value of this element.
 *
 * @param type  the base class
 * @param args  the array of arguments
 * @return the value of this element
 * @throws Exception if calculation is failed
 */
@Override
protected final ValueObject getValueObject(Class<?> type, Object[] args) throws Exception {
    if (this.field != null) {
        return ValueObjectImpl.create(FieldElementHandler.getFieldValue(getContextBean(), this.field));
    }
    if (this.idref != null) {
        return ValueObjectImpl.create(getVariable(this.idref));
    }
    Object bean = getContextBean();
    String name;
    if (this.index != null) {
        name = (args.length == 2)
                ? PropertyElementHandler.SETTER
                : PropertyElementHandler.GETTER;
    } else if (this.property != null) {
        name = (args.length == 1)
                ? PropertyElementHandler.SETTER
                : PropertyElementHandler.GETTER;

        if (0 < this.property.length()) {
            name += this.property.substring(0, 1).toUpperCase(ENGLISH) + this.property.substring(1);
        }
    } else {
        name = (this.method != null) && (0 < this.method.length())
                ? this.method
                : "new"; // NON-NLS: the constructor marker
    }
    Expression expression = new Expression(bean, name, args);
    return ValueObjectImpl.create(expression.getValue());
}
 
Example #20
Source File: XMLSerializer.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
protected Expression instantiate(Object oldInstance, Encoder out) {
    byte[] e = (byte[]) oldInstance;
    return new Expression(e, ByteArrayPersistenceDelegate.class,
            "decode",
            new Object[] { ByteArrayPersistenceDelegate.encode(e) });
}
 
Example #21
Source File: TestEncoder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeExpression(Expression expression) {
    if (this.expression == null) {
        this.expression = expression;
    }
    super.writeExpression(expression);
}
 
Example #22
Source File: ObjectElementHandler.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the value of this element.
 *
 * @param type  the base class
 * @param args  the array of arguments
 * @return the value of this element
 * @throws Exception if calculation is failed
 */
@Override
protected final ValueObject getValueObject(Class<?> type, Object[] args) throws Exception {
    if (this.field != null) {
        return ValueObjectImpl.create(FieldElementHandler.getFieldValue(getContextBean(), this.field));
    }
    if (this.idref != null) {
        return ValueObjectImpl.create(getVariable(this.idref));
    }
    Object bean = getContextBean();
    String name;
    if (this.index != null) {
        name = (args.length == 2)
                ? PropertyElementHandler.SETTER
                : PropertyElementHandler.GETTER;
    } else if (this.property != null) {
        name = (args.length == 1)
                ? PropertyElementHandler.SETTER
                : PropertyElementHandler.GETTER;

        if (0 < this.property.length()) {
            name += this.property.substring(0, 1).toUpperCase(ENGLISH) + this.property.substring(1);
        }
    } else {
        name = (this.method != null) && (0 < this.method.length())
                ? this.method
                : "new"; // NON-NLS: the constructor marker
    }
    Expression expression = new Expression(bean, name, args);
    return ValueObjectImpl.create(expression.getValue());
}
 
Example #23
Source File: Test6707226.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Object value = new Object();

    Expression expression = new Expression(value, Object.class, "new", null);
    if (!value.equals(expression.getValue()))
        throw new Error("the value is updated unexpectedly");

    expression.execute();
    if (value.equals(expression.getValue()))
        throw new Error("the value is not updated as expected");
}
 
Example #24
Source File: Test6707226.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Object value = new Object();

    Expression expression = new Expression(value, Object.class, "new", null);
    if (!value.equals(expression.getValue()))
        throw new Error("the value is updated unexpectedly");

    expression.execute();
    if (value.equals(expression.getValue()))
        throw new Error("the value is not updated as expected");
}
 
Example #25
Source File: Test4936682.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(
            OuterClass.InnerClass.class,
            new DefaultPersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance;
                    OuterClass outer = inner.getOuter();
                    return new Expression(inner, outer, "getInner", new Object[0]);
                }
            }
    );
}
 
Example #26
Source File: Test5023552.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #27
Source File: EnumPersistenceDelegate.java    From bigtable-sql with Apache License 2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
  Enum e = (Enum)oldInstance;
  return new Expression(Enum.class,
                        "valueOf",
                        new Object[] { e.getDeclaringClass(),
                                       e.name() });
}
 
Example #28
Source File: TestEncoder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeExpression(Expression expression) {
    if (this.expression == null) {
        this.expression = expression;
    }
    super.writeExpression(expression);
}
 
Example #29
Source File: UnitValue.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
	UnitValue uv = (UnitValue) oldInstance;
	String cs = uv.getConstraintString();
	if (cs == null)
		throw new IllegalStateException(
				"Design time must be on to use XML persistence. See LayoutUtil.");

	return new Expression(oldInstance, ConstraintParser.class, "parseUnitValueOrAlign", new Object[] {
			uv.getConstraintString(), (uv.isHorizontal() ? Boolean.TRUE : Boolean.FALSE), null });
}
 
Example #30
Source File: Test4936682.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(
            OuterClass.InnerClass.class,
            new DefaultPersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance;
                    OuterClass outer = inner.getOuter();
                    return new Expression(inner, outer, "getInner", new Object[0]);
                }
            }
    );
}