groovy.lang.Tuple.get()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中groovy.lang.Tuple.get()方法的一些代码示例,展示了Tuple.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple.get()方法的具体详情如下:
包路径:groovy.lang.Tuple
类名称:Tuple
方法名:get

Tuple.get介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (!(o instanceof Tuple)) return false;
  Tuple that = (Tuple) o;
  int size = size();
  if (size != that.size()) return false;
  for (int i = 0; i < size; i++) {
    if (!DefaultTypeTransformation.compareEqual(get(i), that.get(i))) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: groovy/groovy-core

public void testGetOutOfTuple() {
  try {
    t.get(-1);
    fail("Should have thrown IndexOut");
  }
  catch (IndexOutOfBoundsException e) {
    // worked
  }
  try {
    t.get(10);
    fail("Should have thrown IndexOut");
  }
  catch (IndexOutOfBoundsException e) {
    // worked
  }
}

代码示例来源:origin: groovy/groovy-core

public void testSize() {
  assertEquals("Size of " + t, 3, t.size());
  assertEquals("get(0)", "a", t.get(0));
  assertEquals("get(1)", "b", t.get(1));
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public List<Object> getUpdatedParams(List<Object> params, List<Tuple> indexPropList) {
  List<Object> updatedParams = new ArrayList<Object>();
  for (Tuple tuple : indexPropList) {
    int index = (Integer) tuple.get(0);
    String prop = (String) tuple.get(1);
    if (index < 0 || index >= params.size())
      throw new IllegalArgumentException("Invalid index " + index + " should be in range 1.." + params.size());
    updatedParams.add(prop.equals("<this>") ? params.get(index) : InvokerHelper.getProperty(params.get(index), prop));
  }
  return updatedParams;
}

代码示例来源:origin: org.codehaus.groovy/groovy-sql

public List<Object> getUpdatedParams(List<Object> params, List<Tuple> indexPropList) {
  List<Object> updatedParams = new ArrayList<Object>();
  for (Tuple tuple : indexPropList) {
    int index = (Integer) tuple.get(0);
    String prop = (String) tuple.get(1);
    if (index < 0 || index >= params.size())
      throw new IllegalArgumentException("Invalid index " + index + " should be in range 1.." + params.size());
    try {
      updatedParams.add(prop.equals("<this>") ? params.get(index) : InvokerHelper.getProperty(params.get(index), prop));
    } catch(MissingPropertyException mpe) {
      throw new IllegalArgumentException("Property '" + prop + "' not found for parameter " + index);
    }
  }
  return updatedParams;
}

相关文章

微信公众号

最新文章

更多