Package java.beans

Examples of java.beans.Statement.execute()


     * @param value
     */
    public static boolean setAttributeValue(String propName, Object owner, Object value){
        try {
            Statement stmt = new Statement(owner, "set" + propName, new Object[]{value}); //$NON-NLS-1$
            stmt.execute();
            return true;
        } catch (Exception e) {
            return false;    }   
    }

View Full Code Here


            /*
             * Set the prefix that is added to each property change event from this class
             */
            Logger.getLogger("PropertyChange").debug("Property change Prefix >" + prefix + "<"); //$NON-NLS-1$ //$NON-NLS-2$
            Statement stmt = new Statement(obj, "setChangePrefix"new Object[] {prefix}); //$NON-NLS-1$
            stmt.execute();
            if ((obj instanceof DataValue) || (obj instanceof GenericNode))
                return;
            BeanInfo bi = Introspector.getBeanInfo(obj.getClass());

            /*
 
View Full Code Here

       
        protected void setValue(Object target, Object value) {
            //Uses Java Beans API
            Statement statement = new Statement(target, method, new Object[] {value});
            try {
                statement.execute();
            } catch (Exception e) {
                //Should never happen
                throw new RuntimeException("Bean error: " + e.getMessage());
            }
        }
View Full Code Here

            Boolean b = getBooleanValue(line, startpos);
            //Uses Java Beans API
            Statement statement = new Statement(getContextObject(stack),
                    method, new Object[] {b});
            try {
                statement.execute();
            } catch (Exception e) {
                //Should never happen
                throw new RuntimeException("Bean error: " + e.getMessage());
            }
        }
View Full Code Here

        try {
          // TODO: this is just a temporary injection solution
          // TODO: test for the existence of the setter before attempting it
          // TODO: avoid exception throwing when there is no setter
          stmt = new Statement(contributor, "set" + serviceName, new Object[]{gatewayServices.getService(serviceName)});
          stmt.execute();
        } catch (NoSuchMethodException e) {
          // TODO: eliminate the possibility of this being thrown up front
        } catch (Exception e) {
          // Maybe it makes sense to throw exception
          log.failedToInjectService( serviceName, e );
View Full Code Here

        protected void setValue(Object target, Object value) {
            //Uses Java Beans API
            Statement statement = new Statement(target, method, new Object[] {value});
            try {
                statement.execute();
            } catch (Exception e) {
                //Should never happen
                throw new RuntimeException("Bean error: " + e.getMessage());
            }
        }
View Full Code Here

            Boolean b = getBooleanValue(line, startpos);
            //Uses Java Beans API
            Statement statement = new Statement(getContextObject(stack),
                    method, new Object[] {b});
            try {
                statement.execute();
            } catch (Exception e) {
                //Should never happen
                throw new RuntimeException("Bean error: " + e.getMessage());
            }
        }
View Full Code Here

     * valid arguments.
     */
    public void testExecute_NormalInstanceMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Statement t = new Statement(mo, "method", new Object[0]);
        t.execute();
        MockObject.assertCalled("method1", new Object[0]);
        t = new Statement(mo, "method", null);
        t.execute();
        MockObject.assertCalled("method1", new Object[0]);
    }
View Full Code Here

        MockObject mo = new MockObject(false);
        Statement t = new Statement(mo, "method", new Object[0]);
        t.execute();
        MockObject.assertCalled("method1", new Object[0]);
        t = new Statement(mo, "method", null);
        t.execute();
        MockObject.assertCalled("method1", new Object[0]);
    }

    /*
     * Test the method execute() with a normal object, normal method and null
View Full Code Here

    public void testExecute_NormalInstanceMethodNull() throws Exception {
        MockObject mo = new MockObject(false);
        Object[] arguments = new Object[] { null, null, null };
        Statement t = new Statement(mo, "method", arguments);

        t.execute();
        MockObject.assertCalled("method5", arguments);
    }

    /*
     * Test the method execute() with a normal object, a valid method that
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.