本文整理汇总了Java中java.beans.Statement.getArguments方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.getArguments方法的具体用法?Java Statement.getArguments怎么用?Java Statement.getArguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.Statement
的用法示例。
在下文中一共展示了Statement.getArguments方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例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);
}
示例3: 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);
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}