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


Java Util.throwIfUnchecked方法代码示例

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


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

示例1: invoke

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public Object invoke(Object proxy, Method method, Object[] args)
    throws Throwable {
  for (Metadata metadata : metadataList) {
    try {
      final Object o = method.invoke(metadata, args);
      if (o != null) {
        return o;
      }
    } catch (InvocationTargetException e) {
      if (e.getCause() instanceof CyclicMetadataException) {
        continue;
      }
      Util.throwIfUnchecked(e.getCause());
      throw new RuntimeException(e.getCause());
    }
  }
  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:ChainedRelMetadataProvider.java

示例2: close

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public void close() {
  final Throwable e = throwableHolder.get();
  if (e != null) {
    throwableHolder.set(null);
    Util.throwIfUnchecked(e);
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:DruidConnectionImpl.java

示例3: cardinality

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public double cardinality(List<Lattice.Column> columns) {
  final List<Double> counts = new ArrayList<>();
  for (Lattice.Column column : columns) {
    try {
      counts.add(cache.get(column));
    } catch (UncheckedExecutionException | ExecutionException e) {
      Util.throwIfUnchecked(e.getCause());
      throw new RuntimeException(e.getCause());
    }
  }
  return (int) Lattice.getRowCount(lattice.getFactRowCount(), counts);
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:CachingLatticeStatisticProvider.java

示例4: query

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public <M extends Metadata> M query(RelNode rel, RelMetadataQuery mq,
    Class<M> metadataClazz) {
  try {
    //noinspection unchecked
    final Pair<Class<RelNode>, Class<Metadata>> key =
        (Pair) Pair.of(rel.getClass(), metadataClazz);
    final Metadata apply = cache.get(key).bind(rel, mq);
    return metadataClazz.cast(apply);
  } catch (UncheckedExecutionException | ExecutionException e) {
    Util.throwIfUnchecked(e.getCause());
    throw new RuntimeException(e.getCause());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:MetadataFactoryImpl.java

示例5: create

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
synchronized <M extends Metadata, H extends MetadataHandler<M>> H create(
    MetadataDef<M> def) {
  try {
    final Key key = new Key((MetadataDef) def, provider,
        ImmutableList.copyOf(ALL_RELS));
    //noinspection unchecked
    return (H) HANDLERS.get(key);
  } catch (UncheckedExecutionException | ExecutionException e) {
    Util.throwIfUnchecked(e.getCause());
    throw new RuntimeException(e.getCause());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:JaninoRelMetadataProvider.java

示例6: set

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public void set(String name, String value) {
  final Method method = setterMethods.get(name);
  try {
    method.invoke(o, value);
  } catch (IllegalAccessException | InvocationTargetException e) {
    Util.throwIfUnchecked(e.getCause());
    throw new RuntimeException(e.getCause());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:SqlPrettyWriter.java

示例7: get

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public Object get(String name) {
  final Method method = getterMethods.get(name);
  try {
    return method.invoke(o);
  } catch (IllegalAccessException | InvocationTargetException e) {
    Util.throwIfUnchecked(e.getCause());
    throw new RuntimeException(e.getCause());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:SqlPrettyWriter.java


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