当前位置: 首页>>代码示例>>Java>>正文


Java Statement类代码示例

本文整理汇总了Java中java.beans.Statement的典型用法代码示例。如果您正苦于以下问题:Java Statement类的具体用法?Java Statement怎么用?Java Statement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Statement类属于java.beans包,在下文中一共展示了Statement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simpleTest

import java.beans.Statement; //导入依赖的package包/类
private static void simpleTest() throws Exception {
    // load the class without initialization
    new Statement(Class.class, "forName", new Object[]{
            "ClassForName$Bean", false, Bean.class.getClassLoader()
    }).execute();
    if (initialized) {
        throw new RuntimeException("Should not be initialized");
    }

    // load the class and initialize it
    new Statement(Class.class, "forName", new Object[]{
            "ClassForName$Bean", true, Bean.class.getClassLoader()
    }).execute();
    if (!initialized) {
        throw new RuntimeException("Should be initialized");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ClassForName.java

示例2: setMethodValue

import java.beans.Statement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <E> void setMethodValue(E obj, Method method, Object... args) {
	try {
		method.setAccessible(true);

		method.invoke(obj, args);

	} catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) {
		// e.printStackTrace();
		try {
			if (obj != null) {
				Statement stmt = new Statement(obj, method.getName(), args);
				stmt.execute();
			}

		} catch (Exception e1) {
			// e1.printStackTrace();
		}
	}
}
 
开发者ID:osonus,项目名称:oson,代码行数:21,代码来源:ObjectUtil.java

示例3: setQueryTimeout

import java.beans.Statement; //导入依赖的package包/类
public static void setQueryTimeout(java.sql.Statement stmt, int timeout) throws SQLException {
  if (timeout < 0) {
    LOG.info("Invalid query timeout " + timeout);
    return;
  }
  try {
    stmt.setQueryTimeout(timeout);
  } catch (SQLException e) {
    String message = e.getMessage() == null ? null : e.getMessage().toLowerCase();
    if (e instanceof SQLFeatureNotSupportedException ||
       (message != null && (message.contains("implemented") || message.contains("supported")))) {
      LOG.info("setQueryTimeout is not supported");
      return;
    }
    throw e;
  }
}
 
开发者ID:mini666,项目名称:hive-phoenix-handler,代码行数:18,代码来源:Utilities.java

示例4: initialize

import java.beans.Statement; //导入依赖的package包/类
@Override
        protected void initialize(Class type, Object oldInstance,
                Object newInstance, Encoder out) {
//            p("image painter delegate called");
            super.initialize(type, oldInstance,  newInstance, out);
            //p("old instance = " + oldInstance);
            //p("owner = " + ((XMLEncoder)out).getOwner());
            PersistenceOwner owner = (PersistenceOwner)((XMLEncoder)out).getOwner();
            ImagePainter ip = (ImagePainter)oldInstance;
//            p("need to convert string: " + ip.getImageString());
//            String s = owner.toXMLURL(ip.getImageString());
//            p("converted to: " + s);
                //out.writeExpression(new Expression(oldInstance,owner,"fromXMLURL",new Object[]{ip.getImageString()}));
                //out.writeStatement(new Statement(owner,"fromXMLURL",new Object[]{ip.getImageString()}));
                //out.writeStatement(new Statement(oldInstance,"setImageString",new Object[]{
                //new Expression(oldInstance,owner,"fromXMLURL",new Object[]{ip.getImageString()})
                //}));
                
            out.writeStatement(new Statement(oldInstance,"setResolver",new Object[]{owner}));
//            out.writeStatement(new Statement(oldInstance,"setImageString",new Object[]{s}));
        }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:PainterUtil.java

示例5: testInitialize_NormalBeanInfo

import java.beans.Statement; //导入依赖的package包/类
public void testInitialize_NormalBeanInfo() throws Exception {
    CollectingEncoder enc = new CollectingEncoder();
    MockPersistenceDelegate pd = new MockPersistenceDelegate();
    MockFoo2 b = new MockFoo2(2);
    MockFoo2 b2 = new MockFoo2(3);
    Iterator<Statement> iter;

    pd.writeObject(b, enc);
    pd.writeObject(b2, enc);
    enc.clearCache();
    pd.initialize(MockFoo2.class, b, b2, enc);

    // XXX RI stores much more statements to the stream
    iter = enc.statements();
    // assertNotNull("required statement not found",
    // findStatement(iter, b, "myget", null));
    assertNotNull("required statement not found", findStatement(iter, null,
            "myset", new Object[] { new Integer(2) }));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:DefaultPersistenceDelegateTest.java

示例6: setValueAt

import java.beans.Statement; //导入依赖的package包/类
public void setValueAt(Object obj, int row, int col) {
    Field field = data.get(row);
    if (field != null) {
        try {
            switch (col) {
                case 1:
                    if (field.getType().getSimpleName().equalsIgnoreCase("int")) {
                        new Statement(appContext, methods.get("set" + field.getName().toLowerCase()).getName(), new Object[]{Integer.parseInt((String) obj)}).execute();
                    } else if (field.getType().getSimpleName().equalsIgnoreCase("boolean")) {
                        field.set(appContext, Boolean.parseBoolean((String) obj));
                    } else if (field.getType().getSimpleName().equalsIgnoreCase("string")) {
                        field.set(appContext, obj);
                    }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    super.fireTableDataChanged();
}
 
开发者ID:cancerian0684,项目名称:dli-downloader,代码行数:21,代码来源:AppConfigTableModel.java

示例7: initialize

import java.beans.Statement; //导入依赖的package包/类
@Override
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);

    Public<String, String> map = (Public) oldInstance;
    for (Entry<String, String> entry : map.getAll()) {
        String[] args = {entry.getKey(), entry.getValue()};
        out.writeStatement(new Statement(oldInstance, "put", args));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:Test8013416.java

示例8: testStatement

import java.beans.Statement; //导入依赖的package包/类
private static void testStatement() {
    Object[] array = { new Object() };
    Statement statement = new Statement(null, null, array);
    test(statement.getArguments());
    array[0] = null;
    test(statement.getArguments());
    statement.getArguments()[0] = null;
    test(statement.getArguments());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:Test8005065.java

示例9: initialize

import java.beans.Statement; //导入依赖的package包/类
@Override
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()}));
  }
}
 
开发者ID:mini666,项目名称:hive-phoenix-handler,代码行数:13,代码来源:Utilities.java

示例10: initialize

import java.beans.Statement; //导入依赖的package包/类
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() }));

    }

}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:CollectionPersistenceDelegate.java

示例11: writeStatement

import java.beans.Statement; //导入依赖的package包/类
/** Scans the argument and calls one of event methods. See
 * the introduction of this class for details.
 *
 * @param stmt The statement to serialize.
 */
public void writeStatement(Statement stmt)
{
  // This is a simplified version of writeExpression. Everything
  // that would not create something that is embedded in a <void> tag
  // is left out (instantiation, getters, ...).
  // TODO: Is this the right thing to do?

  String methodName = stmt.getMethodName();
  Object target = stmt.getTarget();
  Object[] args = stmt.getArguments();

  if (target == Array.class && methodName.equals("set"))
    {
      arraySet(args[1].toString());
      return;
    }

  if (target instanceof List)
    {
      if (methodName.equals("set"))
        {
          listSet();
          return;
        }
    }

  // If nothing else could be used then this is a normal
  // method invocation.
  methodInvocation(methodName);
}
 
开发者ID:vilie,项目名称:javify,代码行数:36,代码来源:ScanEngine.java

示例12: initialize

import java.beans.Statement; //导入依赖的package包/类
protected void initialize(Class type, Object oldInstance, Object newInstance,
                          Encoder out)
{
  Map map = (Map) oldInstance;
  Iterator ite = map.keySet().iterator();

  while (ite.hasNext())
    {
      Object key = ite.next();
      out.writeStatement(new Statement(oldInstance, "put",
                                       new Object[] { key, map.get(key) }));

    }

}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:MapPersistenceDelegate.java

示例13: writeStatement

import java.beans.Statement; //导入依赖的package包/类
/** Scans the argument and calls one of event methods. See
 * the introduction of this class for details.
 * 
 * @param stmt The statement to serialize.
 */
public void writeStatement(Statement stmt)
{
  // This is a simplified version of writeExpression. Everything
  // that would not create something that is embedded in a <void> tag
  // is left out (instantiation, getters, ...).
  // TODO: Is this the right thing to do?

  String methodName = stmt.getMethodName();
  Object target = stmt.getTarget();
  Object[] args = stmt.getArguments();

  if (target == Array.class && methodName.equals("set"))
    {
      arraySet(args[1].toString());
      return;
    }

  if (target instanceof List)
    {
      if (methodName.equals("set"))
        {
          listSet();
          return;
        }
    }

  // If nothing else could be used then this is a normal
  // method invocation.
  methodInvocation(methodName);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:36,代码来源:ScanEngine.java

示例14: BooleanInvocationHandler

import java.beans.Statement; //导入依赖的package包/类
public BooleanInvocationHandler(Object target, String methodName) {
    // Create the true and false statements.
    falseStatement = new Statement(target, methodName, 
                                   new Object[] { Boolean.FALSE });
    
    trueStatement = new Statement(target, methodName, 
                                  new Object[] { Boolean.TRUE });
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:BoundAction.java

示例15: itemStateChanged

import java.beans.Statement; //导入依赖的package包/类
@Override
public void itemStateChanged(ItemEvent evt) {
    Statement statement = (evt.getStateChange() == ItemEvent.DESELECTED) ? falseStatement
            : trueStatement;

    try {
        statement.execute();
    } catch (Exception ex) {
        LOG.log(Level.FINE,
                "Couldn't execute boolean method via Statement "
                        + statement, ex);
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:BoundAction.java


注:本文中的java.beans.Statement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。