/** * Formats a message for an index out of 2D bounds. */ static String indexOutOfBounds(final int dimension) { return Errors.format(ErrorKeys.INDEX_OUT_OF_BOUNDS_$1, dimension); }
/** * Constructs an exception with an error message formatted for the specified class. * * @param classe The unexpected implementation class. */ public UnsupportedImplementationException(final Class<?> classe) { super(Errors.format(ErrorKeys.UNKNOW_TYPE_$1, classe)); }
/** * Creates a new exception with a default message determined from the specified category. */ public RecursiveSearchException(final Class<?> category) { super(Errors.format(ErrorKeys.RECURSIVE_CALL_$1, category)); }
/** * Constructs an exception with an error message formatted for the specified class * and a cause. * * @param classe The unexpected implementation class. * @param cause The cause for the exception. */ public UnsupportedImplementationException(final Class<?> classe, final Exception cause) { super(Errors.format(ErrorKeys.UNKNOW_TYPE_$1, classe), cause); } }
/** * Make sure that {@link #type} is non-null. */ private void ensureNonNull() { if (type == null) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "type")); } }
/** * Ensures that the specified value is non-null. */ private static void ensureNotNull(final Object value) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "value")); } }
/** * Ensure that the given argument is non-null. */ private static void ensureNonNull(final Class<?> type, final String name) { if (type == null) { throw new NullPointerException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, name)); } }
/** * Make sure that {@link #type} is non-null. */ private void ensureNonNull() { if (type == null) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "type")); } }
public RasterLayout(Rectangle bounds) { if (bounds == null) throw new NullPointerException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "bounds")); this.height = bounds.height; this.width = bounds.width; this.minX = bounds.x; this.minY = bounds.y; }
/** * Returns an exception for an unnkown type. */ private static IllegalArgumentException unknownType(final Class<?> type) { return new IllegalArgumentException(Errors.format(ErrorKeys.UNKNOW_TYPE_$1, type)); } }
private static MathTransform checkMathTransform(MathTransform transform) { if(transform==null) throw new IllegalArgumentException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1,"transform")); return transform; }
/** * Ensures that the specified argument is non-null. */ private static void ensureNonNull(final String name, final Object value) { if (value == null) { throw new NullPointerException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, name)); } } }
/** * Ensures that the given type is compatible with the type expected by this range. */ private void ensureCompatible(final Class<?> type) throws IllegalArgumentException { if (!elementClass.isAssignableFrom(type)) { throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_CLASS_$2, type, elementClass)); } }
/** * Creates an exception for a value not being an integer. * * @param i the value index. * @return The exception. */ private ParseException notAnInteger(final int i) { return new ParseException(Errors.format(ErrorKeys.NOT_AN_INTEGER_$1, line.substring(limits[i], limits[i+1])), limits[i]); }
/** * Format an error message saying that the specified factory is not yet supported. * The error message will be given to a {@link FactoryNotFoundException}. * * @param type The factory type requested by the users. */ private static String unsupportedFactory(final Class type) { return Errors.format(ErrorKeys.FACTORY_NOT_FOUND_$1, Classes.getShortName(type)); }
/** * Ensure the specified point is one-dimensional. */ private static void checkDimension(final DirectPosition point) { final int dim = point.getDimension(); if (dim != 1) { throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$2, new Integer(1), new Integer(dim))); } }
/** * Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() * call in constructors"). */ private static UnitConverter getConverter(final Unit<?> source) throws ConversionException { if (source == null) { throw new ConversionException(Errors.format(ErrorKeys.NO_UNIT)); } return source.getConverterTo(MILLISECOND); }
/** * Ensure the specified point is one-dimensional. */ private static void checkDimension(final DirectPosition point) { final int dim = point.getDimension(); if (dim != 1) { throw new MismatchedDimensionException(Errors.format( ErrorKeys.MISMATCHED_DIMENSION_$2, 1, dim)); } }
/** Construct a list of categories. Used by constructors only. */ private static CategoryList list(final Category[] categories, final Unit units) { if (categories == null) { return null; } final CategoryList list = new CategoryList(categories, units); if (CategoryList.isScaled(categories, false)) return list; if (CategoryList.isScaled(categories, true )) return list.inverse; throw new IllegalArgumentException(Errors.format(ErrorKeys.MIXED_CATEGORIES)); }
public Coverage doOperation(ParameterValueGroup parameters, Hints hints) { try { return ScaledGridCoverage2D .create(parameters, (hints instanceof Hints) ? (Hints) hints : new Hints(hints)); } catch (NoninvertibleTransformException e) { throw new CannotScaleException(Errors .format(ErrorKeys.NONINVERTIBLE_SCALING_TRANSFORM), e); } } }