Package java.beans

Examples of java.beans.Expression


                        @SuppressWarnings("unchecked")
                        @Override
                        protected void initialize(Class type,
                                Object oldInstance, Object newInstance,
                                Encoder out) {
                            out.writeExpression(new Expression(object,
                                    oldInstance, "go", new Object[] {}));
                        }
                    });
            AType a = new AType();
View Full Code Here


   * Java 1.5 workaround. From http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5015403
   */
  public static class EnumDelegate extends DefaultPersistenceDelegate {
    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      return new Expression(Enum.class, "valueOf", new Object[] {oldInstance.getClass(),
          ((Enum<?>) oldInstance).name()});
    }
View Full Code Here

  public static class MapDelegate extends DefaultPersistenceDelegate {
    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      Map oldMap = (Map) oldInstance;
      HashMap newMap = new HashMap(oldMap);
      return new Expression(newMap, HashMap.class, "new", new Object[] {});
    }
View Full Code Here

  public static class SetDelegate extends DefaultPersistenceDelegate {
    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      Set oldSet = (Set) oldInstance;
      HashSet newSet = new HashSet(oldSet);
      return new Expression(newSet, HashSet.class, "new", new Object[] {});
    }
View Full Code Here

  public static class ListDelegate extends DefaultPersistenceDelegate {
    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      List oldList = (List) oldInstance;
      ArrayList newList = new ArrayList(oldList);
      return new Expression(newList, ArrayList.class, "new", new Object[] {});
    }
View Full Code Here

    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      Date dateVal = (Date)oldInstance;
      Object[] args = { dateVal.getTime() };
      return new Expression(dateVal, dateVal.getClass(), "new", args);
    }
View Full Code Here

  public static class CommonTokenDelegate extends PersistenceDelegate {
    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      CommonToken ct = (CommonToken)oldInstance;
      Object[] args = {ct.getType(), ct.getText()};
      return new Expression(ct, ct.getClass(), "new", args);
    }
View Full Code Here

  }

  public static class CollectionPersistenceDelegate extends DefaultPersistenceDelegate {
    @Override
    protected Expression instantiate(Object oldInstance, Encoder out) {
      return new Expression(oldInstance, oldInstance.getClass(), "new", null);
    }
View Full Code Here

                        @SuppressWarnings("unchecked")
                        @Override
                        protected void initialize(Class type,
                                Object oldInstance, Object newInstance,
                                Encoder out) {
                            out.writeExpression(new Expression(object,
                                    oldInstance, "go", new Object[] {}));
                        }
                    });
            AType a = new AType();
View Full Code Here

        MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[] {
                "prop1", "prop2" });
        MockBean b = new MockBean();
        Encoder enc = new Encoder();
        b.setAll("bean1", 2);
        Expression e = pd.instantiate(b, enc);
        assertSame(b, e.getValue());
        assertSame(MockBean.class, e.getTarget());
        assertEquals("new", e.getMethodName());
        assertSame("bean1", e.getArguments()[0]);
        assertEquals(new Integer(2), e.getArguments()[1]);
    }
View Full Code Here

TOP

Related Classes of java.beans.Expression

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.