public Readonly check(String message) throws ReadonlyException { if(enabled){ throw new ReadonlyException(message); } return this; } }
protected static Function<DatabaseMetaData,Boolean> productNameEqualsIgnorecaseMatcher(final String name){ return new Function<DatabaseMetaData,Boolean>() { @Override public Boolean apply(DatabaseMetaData dm) { try { return dm.getDatabaseProductName().equalsIgnoreCase(name); } catch (SQLException e) { throw new NestedSQLException(e); } } }; }
@Override public DataSource getDefaultDataSource() { if(null == defaultDataSource){ throw new ObjectNotFoundException("No default dataSource defined"); } return defaultDataSource; }
@Override public Object single() throws EmptyElementsException, TooManyElementsException { if(l.isEmpty()) { throw new EmptyElementsException("No scalar values, cannot return the single one"); } if(l.size() > 1) { throw new TooManyElementsException("There are " + l.size() + " scalar values, cannot return the single one"); } return l.get(0); }
public static NestedUnsupportedEncodingException wrap(UnsupportedEncodingException e){ return new NestedUnsupportedEncodingException(e); }
@Override public E first() throws EmptyElementsException { throw new EmptyElementsException(); }
public static void wrapAndThrow(String message,IOException e){ throw new NestedIOException(message,e); }
public IOException getIOException(){ return (IOException)getCause(); }
public UnsupportedEncodingException getUnsupportedEncodingException(){ return (UnsupportedEncodingException)getCause(); } }
public ServletException getServletException(){ return (ServletException)getCause(); }
@Override public E single() throws EmptyElementsException, TooManyElementsException { int size = size(); if(size == 0){ throw new EmptyElementsException(); } if(size > 1){ throw new TooManyElementsException(); } return get(0); }
public static void wrapAndThrow(String message,SQLException e){ throw new NestedSQLException(message,e); }
public static NestedUnsupportedEncodingException wrap(String message,UnsupportedEncodingException e){ return new NestedUnsupportedEncodingException(message,e); }
@Override public E single() throws EmptyElementsException, TooManyElementsException { throw new EmptyElementsException(); }
public V setValue(V value) { throw new ReadonlyException("this entry is immutable"); } }
public Readonly check() throws ReadonlyException { if(enabled){ throw new ReadonlyException(null == message ? "object readonly" : message); } return this; }
protected static ReadonlyException readonlyException() { return new ReadonlyException("unsupported operation, this collection is immutable"); } }
protected static ReadonlyException readonlyException() { return new ReadonlyException("unsupported operation, this map is immutable"); } }