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


Java Statement.getTarget方法代码示例

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


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

示例1: 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

示例2: 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

示例3: findStatement

import java.beans.Statement; //导入方法依赖的package包/类
/**
 * Searches for the statement with given parameters.
 * 
 * @param iter
 *            iterator to search through, null means ignore this parameter
 * @param target
 * @param methodName
 * @param args
 * @return found statement or null
 */
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;
                }
            }
        }

        return stmt;
    }

    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:46,代码来源:DefaultPersistenceDelegateTest.java

示例4: string

import java.beans.Statement; //导入方法依赖的package包/类
public static String string(Statement stat) {
    String str = "(" + stat.getTarget() + ")." + stat.getMethodName() + "(";
    Object args[] = stat.getArguments();
    for (int i = 0; i < args.length; i++) {
        if (i > 0) {
            str += ", ";
        }
        str += args[i];
    }
    str = str + ")";
    return str;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:XMLEncoderTest.java

示例5: findStatement

import java.beans.Statement; //导入方法依赖的package包/类
/**
 * Searches for the statement with given parameters.
 * @param iter iterator to search through, null means ignore this parameter
 * @param target
 * @param methodName
 * @param args
 * @return found statement or null
 */
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;
                }
            }
        }

        return stmt;
    }
    
    return null;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:47,代码来源:DefaultPersistenceDelegateTest.java

示例6: equals

import java.beans.Statement; //导入方法依赖的package包/类
private boolean equals(Statement stmt, Class<?> targetClass,
                          String methodName, Object[] args) {
       
    if (stmt == null || !methodName.equals(stmt.getMethodName())) {
        return false;
    }

    if (targetClass != null) {
        // check if we have the object of the same class at least
        if (targetClass != stmt.getTarget().getClass()) {
            return false;
        }
    } else {
        if (stmt.getTarget() != null) {
            return false;
        }
    }
    
    if (args != null) {
        if (stmt.getArguments() == null ||
            args.length != stmt.getArguments().length) {
            return false;
        }

        for (int i = 0; i < args.length; i++) {

            if (args[i] != null) {
                if (!args[i].equals(stmt.getArguments()[i])) {
                    return false;
                }
            } else {
                if (stmt.getArguments()[i] != null) {
                    return false;
                }
            }
        }
    } else {
        if (stmt.getArguments() != null && stmt.getArguments().length > 0) {
            return false;
        }
    }
    
    return true;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:45,代码来源:PersistenceDelegateTest.java


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