/** * Gets a string for the given key from this resource bundle or one of its parents. * * @param key The key for the desired string. * @return The string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key) throws MissingResourceException { return getResources(null).getString(key); }
/** * Returns a localized string for the specified error key. */ final String getString(final int key) { return Errors.getResources(locale).getString(key); }
/** * Gets a string for the given key from this resource bundle or one of its parents. * * @param key The key for the desired string. * @return The string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key) throws MissingResourceException { return getResources(null).getString(key); }
/** * Gets a string for the given key are replace all occurence of "{0}" * with values of {@code arg0}. * * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key, final Object arg0) throws MissingResourceException { return getResources(null).getString(key, arg0); }
/** * Gets a string for the given key are replace all occurence of "{0}" * with values of {@code arg0}. * * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key, final Object arg0) throws MissingResourceException { return getResources(null).getString(key, arg0); }
/** * Gets a string for the given key are replace all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}. * * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key, final Object arg0, final Object arg1) throws MissingResourceException { return getResources(null).getString(key, arg0, arg1); }
/** * Gets a string for the given key are replace all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}. * * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key, final Object arg0, final Object arg1) throws MissingResourceException { return getResources(null).getString(key, arg0, arg1); }
/** * Gets a string for the given key are replace all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}, etc. * * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @param arg2 Value to substitute to "{2}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key, final Object arg0, final Object arg1, final Object arg2) throws MissingResourceException { return getResources(null).getString(key, arg0, arg1, arg2); }
/** * Gets a string for the given key are replace all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}, etc. * * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @param arg2 Value to substitute to "{2}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static String format(final int key, final Object arg0, final Object arg1, final Object arg2) throws MissingResourceException { return getResources(null).getString(key, arg0, arg1, arg2); }
/** * Check if an angle is of expected type (latitude or longitude). */ private void checkAngle(final JSpinner field, final boolean expectLatitude) throws ParseException { final Object angle=field.getValue(); if (expectLatitude ? (angle instanceof Longitude) : (angle instanceof Latitude)) { throw new ParseException(Errors.getResources(getLocale()).getString( ErrorKeys.BAD_COORDINATE_$1, angle), 0); } }
/** * Checks the format name. */ private void checkFormatName(final String formatName) throws IllegalArgumentException { if (!GeographicMetadataFormat.FORMAT_NAME.equals(formatName)) { throw new IllegalArgumentException(Errors.getResources(getLocale()).getString( ErrorKeys.ILLEGAL_ARGUMENT_$2, "formatName", formatName)); } }
/** * Returns a localized error message for {@link IndexOutOfBoundsException}. */ private String indexOutOfBounds(final int index) { return Errors.getResources(getLocale()). getString(ErrorKeys.ILLEGAL_ARGUMENT_$2, "index", new Integer(index)); }
/** * Returns a localized error message for {@link IndexOutOfBoundsException}. */ private String indexOutOfBounds(final int index) { return Errors.getResources(getLocale()). getString(ErrorKeys.ILLEGAL_ARGUMENT_$2, "index", index); }
/** * Implementation of {@link #addOperation} method. Also used by {@link #scanForPlugins} * instead of the public method in order to avoid never-ending loop. */ private void addOperation0(final Operation operation) throws IllegalStateException { final String name = operation.getName().trim(); final Operation old = operations.put(name, operation); if (old!=null && !old.equals(operation)) { operations.put(old.getName().trim(), old); throw new IllegalStateException(Errors.getResources(getLocale()).getString( ErrorKeys.OPERATION_ALREADY_BOUND_$1, operation.getName())); } }
/** * Implementation of {@link #addOperation} method. Also used by {@link #scanForPlugins} * instead of the public method in order to avoid never-ending loop. */ private void addOperation0(final Operation operation) throws IllegalStateException { final String name = operation.getName().trim(); final Operation old = (Operation) operations.put(name, operation); if (old!=null && !old.equals(operation)) { operations.put(old.getName().trim(), old); throw new IllegalStateException(Errors.getResources(getLocale()).getString( ErrorKeys.OPERATION_ALREADY_BOUND_$1, operation.getName())); } }
/** * Returns the list of unprocessed arguments. If the number of remaining arguments is * greater than the specified maximum, then this method invokes {@link #illegalArgument}. * * @param max Maximum remaining arguments autorized. * @return An array of remaining arguments. Will never be longer than {@code max}. */ public String[] getRemainingArguments(final int max) { int count = 0; final String[] left = new String[Math.min(max, arguments.length)]; for (int i=0; i<arguments.length; i++) { final String arg = arguments[i]; if (arg != null) { if (count >= max) { illegalArgument(new IllegalArgumentException(Errors.getResources(locale). getString(ErrorKeys.UNEXPECTED_PARAMETER_$1, arguments[i]))); } left[count++] = arg; } } return XArray.resize(left, count); }
/** * Returns an required string value from the command line. This method * works like {@link #getOptionalString}, except that it will invokes * {@link #illegalArgument} if the specified parameter was not given * on the command line. * * @param name The parameter name. Name are case-insensitive. * @return The parameter value. */ public String getRequiredString(final String name) { final String value = getOptionalString(name); if (value == null) { illegalArgument(new IllegalArgumentException(Errors.getResources(locale). getString(ErrorKeys.MISSING_PARAMETER_$1, name))); } return value; }
/** * Returns an required string value from the command line. This method * works like {@link #getOptionalString}, except that it will invokes * {@link #illegalArgument} if the specified parameter was not given * on the command line. * * @param name The parameter name. Name are case-insensitive. * @return The parameter value. */ public String getRequiredString(final String name) { final String value = getOptionalString(name); if (value == null) { illegalArgument(new IllegalArgumentException(Errors.getResources(locale). getString(ErrorKeys.MISSING_PARAMETER_$1, name))); } return value; }
/** * Constructs an error message for a point outside the coverage. * This is used for formatting error messages. * * @param point The coordinate point to format. * @return An error message. */ protected String pointOutsideCoverage(final DirectPosition point) { final Locale locale = getLocale(); return Errors.getResources(locale). getString(ErrorKeys.POINT_OUTSIDE_COVERAGE_$1, toString(point, locale)); }
/** * Constructs an error message for a position that can not be evaluated. * This is used for formatting error messages. * * @param point The coordinate point to format. * @param outside {@code true} if the evaluation failed because the given point is outside * the coverage, or {@code false} if it failed for an other (unknown) reason. * @return An error message. * * @since 2.5 */ protected String formatEvaluateError(final DirectPosition point, final boolean outside) { final Locale locale = getLocale(); return Errors.getResources(locale). getString(outside ? ErrorKeys.POINT_OUTSIDE_COVERAGE_$1 : ErrorKeys.CANT_EVALUATE_$1, toString(point, locale)); }