List of usage examples for com.google.common.collect ComputationException getCause
public synchronized Throwable getCause()
From source file:net.conquiris.qs.DecoratorDescriptor.java
/** * Returns the descriptor for a token class. * @param tokenType Token type.// w ww .j a v a2s . co m * @return The decorator descriptos. * @throws NullPointerException if the argument is {@code null}. * @throws IllegalArgumentException if the token type is not well-defined of the qualifier is of * an incorrect type. */ static DecoratorDescriptor get(Class<? extends DecoratorToken<?>> tokenType) { try { return MAP.get(tokenType); } catch (ComputationException e) { throw (RuntimeException) e.getCause(); } }
From source file:net.conquiris.qs.QueryDescriptor.java
/** * Returns the descriptor for a token class. * @param tokenType Token type./*from w w w.ja v a 2s. c o m*/ * @return The decorator descriptos. * @throws NullPointerException if the argument is {@code null}. * @throws IllegalArgumentException if the token type is not well-defined of the qualifier is of * an incorrect type. */ static QueryDescriptor get(Class<? extends DecoratorToken<?>> tokenType) { try { return MAP.get(tokenType); } catch (ComputationException e) { throw (RuntimeException) e.getCause(); } }
From source file:com.isotrol.impe3.core.support.AbstractFileLoader.java
private <T extends AbstractFileData> T load(UUID id, Class<T> type) { checkNotNull(id, "File id required"); try {/*from w ww .ja va 2 s.com*/ AbstractFileData afd = map.getUnchecked(id); checkArgument(type.isInstance(afd), "Invalid file type"); return type.cast(afd); } catch (NullPointerException npe) { throw new IllegalArgumentException(NOT_FOUND); } catch (ComputationException ce) { final Throwable cause = ce.getCause(); if (cause instanceof IllegalArgumentException) { throw (IllegalArgumentException) cause; } else if (cause instanceof UnableToLoadFileException) { throw (UnableToLoadFileException) cause; } throw new UnableToLoadFileException(cause); } }