Package java.beans

Examples of java.beans.Expression


            //use the default constructor
            AffineTransform tx = new AffineTransform();
            PathIterator itr = a.getPathIterator(tx);
           
            GeneralPath path = new GeneralPath();
            out.writeExpression(new Expression(path, GeneralPath.class, "new", new Object[0]));
           
            while (!itr.isDone()) {
                float[] segment = new float[6]; //must use floats because lineTo etc use floats
                int pathType = itr.currentSegment(segment);
               
                switch (pathType) {
                    case PathIterator.SEG_CLOSE:
                        out.writeStatement(new Statement(path, "closePath", new Object[0]));
                        break;
                    case PathIterator.SEG_CUBICTO:
                        out.writeStatement(new Statement(path, "curveTo", new Object[] {segment[0], segment[1], segment[2], segment[3], segment[4], segment[5]}));
                        break;
                    case PathIterator.SEG_LINETO:
                        out.writeStatement(new Statement(path, "lineTo", new Object[] {segment[0], segment[1]}));
                        break;
                    case PathIterator.SEG_MOVETO:
                        out.writeStatement(new Statement(path, "moveTo", new Object[] {segment[0], segment[1]}));
                        break;
                    case PathIterator.SEG_QUADTO:
                        out.writeStatement(new Statement(path, "quadTo", new Object[] {segment[0], segment[1], segment[2], segment[3]}));
                        break;
                }
                itr.next();
            }
           
            return new Expression(a, Area.class, "new", new Object[] {path});
        }
View Full Code Here


        }
    }
    public static final class GeneralPathDelegate extends PersistenceDelegate {
        @Override
        protected Expression instantiate(Object oldInstance, Encoder out) {
            return new Expression(oldInstance, GeneralPath.class, "new", new Object[0]);
        }
View Full Code Here

            for ( Field field : type.getFields() ) {
                int mod = field.getModifiers();
                if ( Modifier.isPublic( mod ) && Modifier.isStatic( mod ) && Modifier.isFinal( mod ) && ( type == field.getDeclaringClass() ) ) {
                    try {
                        if ( oldInstance == field.get( null ) )
                            return new Expression( oldInstance, field, "get", new Object[]{null} );
                    } catch ( IllegalAccessException exception ) {
                        throw new IllegalArgumentException( "Could not get value of the field: " + field, exception );
                    }
                }
            }
View Full Code Here

    public static final class RenderingHintsDelegate extends PersistenceDelegate {
        @Override
        protected Expression instantiate(Object oldInstance, Encoder out) {
            //u.p("rh inst");
            // give it a constructor w/ null as the argument
            return new Expression(oldInstance, oldInstance.getClass(),
                    "new", new Object[] { null });
        }
View Full Code Here

                // System.out.println("doRun(): arg [" + i + "] =
                // null");
                // }
                // }

                Expression expr = new Expression(target, methodName,
                        getArgumentsValues());
                result = new Argument(expr.getValue());

                if (isPrimitiveClassName(getTagName())) {
                    result.setType(getPrimitiveClass(tagName));
                }
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

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.