Package java.beans

Examples of java.beans.Statement$MethodComparator


    @Override
    protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) {
      Iterator ite = ((Collection) oldInstance).iterator();
      while (ite.hasNext()) {
        out.writeStatement(new Statement(oldInstance, "add", new Object[] {ite.next()}));
      }
    }
View Full Code Here


        MockBean4Owner_Target t = new MockBean4Owner_Target();
        MockBean4Owner_Owner o = new MockBean4Owner_Owner();
        t.setV(o);
        enc.setOwner(o);

        enc.writeStatement(new Statement(o, "loading", new Object[] {}));

        assertCodedXML(t, "/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml",
                temp, enc);

    }
View Full Code Here

     */
    static Statement findStatement(Iterator<Statement> iter, Object target,
            String methodName, Object[] args) {

        while (iter.hasNext()) {
            Statement stmt = iter.next();

            if (target != null && stmt.getTarget() != target) {
                continue;
            }

            if (methodName != null && !methodName.equals(stmt.getMethodName())) {
                continue;
            }

            if (args != null) {
                if ((stmt.getArguments() != null && args.length != stmt
                        .getArguments().length)
                        || stmt.getArguments() == null) {
                    continue;
                }

                for (int i = 0; i < args.length; i++) {
                    if ((args[i] == null && stmt.getArguments()[i] != null)
                            || (args[i] != null && stmt.getArguments()[i] == null)
                            || !args[i].equals(stmt.getArguments()[i])) {
                        continue;
                    }
                }
            }

View Full Code Here

        catch ( ComponentLookupException e )
        {
            reportErrorCannotLookupRequiredComponent( descriptor, requirement, e );
        }

        final Statement statement = new Statement( component, writeMethod.getName(), params );

        try
        {
            statement.execute();
        }
        catch ( Exception e )
        {          
            reportErrorCannotAssignRequiredComponent( descriptor, requirement, e );
        }
View Full Code Here

    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
      java.util.Collection oldO = (java.util.Collection) oldInstance;
      java.util.Collection newO = (java.util.Collection) newInstance;

      if (newO.size() != 0) {
        out.writeStatement(new Statement(oldInstance, "clear", new Object[] {}));
      }
      for (Iterator i = oldO.iterator(); i.hasNext();) {
        out.writeStatement(new Statement(oldInstance, "add", new Object[] {i.next()}));
      }
    }
View Full Code Here

    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
      java.util.Collection oldO = (java.util.Collection) oldInstance;
      java.util.Collection newO = (java.util.Collection) newInstance;

      if (newO.size() != 0) {
        out.writeStatement(new Statement(oldInstance, "clear", new Object[] {}));
      }
      for (Iterator i = oldO.iterator(); i.hasNext();) {
        out.writeStatement(new Statement(oldInstance, "add", new Object[] {i.next()}));
      }
    }
View Full Code Here

    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
      java.util.Collection oldO = (java.util.Collection) oldInstance;
      java.util.Collection newO = (java.util.Collection) newInstance;

      if (newO.size() != 0) {
        out.writeStatement(new Statement(oldInstance, "clear", new Object[] {}));
      }
      for (Iterator i = oldO.iterator(); i.hasNext();) {
        out.writeStatement(new Statement(oldInstance, "add", new Object[] {i.next()}));
      }
    }
View Full Code Here

    @Override
    protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) {
      Iterator ite = ((Collection) oldInstance).iterator();
      while (ite.hasNext()) {
        out.writeStatement(new Statement(oldInstance, "add", new Object[] {ite.next()}));
      }
    }
View Full Code Here

  {
    dummy d = new dummy();

    // Check that we can create and execute a statement
    Object arg1[] = {"test"};
    Statement stmt = new Statement(d, "method", arg1);
    harness.check(stmt != null);
    harness.check(stmt.getTarget() == d);
    harness.check(stmt.getMethodName().equals("method"));

    try
      {
  stmt.execute();
      }
    catch (Exception e)
      {
  harness.fail("Statement execute");
      }

    harness.check(d.s.equals("test"));
    harness.check(d.x == 5);

    // Check that we can create and execute a statement and that a
    // wrapper class resolves to a method taking a primitive.
    Object arg2[] = {"test", new Integer(6) };
    stmt = new Statement(d, "method", arg2);
    harness.check(stmt != null);

    Object stmtArgs[] = stmt.getArguments();
    harness.check(stmtArgs.length == arg2.length && stmtArgs[0] == arg2[0]
      && stmtArgs[1] == arg2[1]);

    try
      {
  stmt.execute();
      }
    catch (Exception e)
      {
  harness.fail("Statement execute");
      }

    harness.check(d.s.equals("test"));
    harness.check(d.x == 7);


    // Check that we can create and execute a statement for a static method.
    Object arg3[] = {new Integer(1)};
    stmt = new Statement(this, "test1", arg3);
   
    try
      {
  stmt.execute();
      }
    catch (Exception e)
      {
  harness.fail("Static method execute " + e.toString());
      }
    harness.check(x == 1);


    // Check that we can call get and set on an array object in a statement
    int iarray[] = {1, 2, 3, 4, 5};
    Object arg4[] = { new Integer(2), new Integer(6) };

    stmt = new Statement(iarray, "set", arg4);
    try
      {
  stmt.execute();
      }
    catch (Exception e)
      {
  harness.fail("Array set");
      }

    Object arg5[] = { new Integer(2) };
    stmt = new Statement(iarray, "get", arg5);
   
    try
      {
  stmt.execute();
      }
    catch (Exception e)
      {
  harness.fail("Array get");
      }
View Full Code Here

                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();
            }
           
View Full Code Here

TOP

Related Classes of java.beans.Statement$MethodComparator

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.