/** * Returns the message to put in an {@link UnavailableFactoryException} having the given cause. */ private String canNotUse(final String cause) { return Resources.forLocale(locale).getString(Resources.Keys.CanNotUseGeodeticParameters_2, Constants.EPSG, cause); }
/** * 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 short key) throws MissingResourceException { return forLocale(null).getString(key); }
/** * Returns a human-readable text for this constant. * * @param locale the desired locale, or {@code null}. * @return a human-readable text in the given locale if possible. */ @Override public String toString(final Locale locale) { return Resources.forLocale(locale).getString(opposite ? Resources.Keys.InverseOperationUsesOppositeSign : Resources.Keys.InverseOperationUsesSameSign); }
/** * Returns the message to put in an {@link UnavailableFactoryException} having the given cause. */ private String canNotUse(final String cause) { return Resources.forLocale(locale).getString(Resources.Keys.CanNotUseGeodeticParameters_2, Constants.EPSG, cause); }
/** * 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 short key) throws MissingResourceException { return forLocale(null).getString(key); }
/** * Returns a human-readable text for this constant. * * @param locale the desired locale, or {@code null}. * @return a human-readable text in the given locale if possible. */ @Override public String toString(final Locale locale) { return Resources.forLocale(locale).getString(opposite ? Resources.Keys.InverseOperationUsesOppositeSign : Resources.Keys.InverseOperationUsesSameSign); }
/** * Gets a string for the given key are replace all occurrence 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 short key, final Object arg0) throws MissingResourceException { return forLocale(null).getString(key, arg0); }
/** * Gets a string for the given key are replace all occurrence 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 short key, final Object arg0) throws MissingResourceException { return forLocale(null).getString(key, arg0); }
/** * Gets a string for the given key are replace all occurrence 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 short key, final Object arg0, final Object arg1) throws MissingResourceException { return forLocale(null).getString(key, arg0, arg1); }
/** * Gets a string for the given key are replace all occurrence 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 short key, final Object arg0, final Object arg1) throws MissingResourceException { return forLocale(null).getString(key, arg0, arg1); }
/** * Gets a string for the given key are replace all occurrence 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 short key, final Object arg0, final Object arg1, final Object arg2) throws MissingResourceException { return forLocale(null).getString(key, arg0, arg1, arg2); }
/** * Gets a string for the given key are replace all occurrence 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 short key, final Object arg0, final Object arg1, final Object arg2) throws MissingResourceException { return forLocale(null).getString(key, arg0, arg1, arg2); }
/** * Creates an exception for an unknown authority code. * This convenience method is provided for implementation of {@code createFoo(String)} methods. * * @param type the GeoAPI interface that was to be created (e.g. {@code CoordinateReferenceSystem.class}). * @param code the unknown authority code. * @return an exception initialized with an error message built from the specified informations. */ private NoSuchAuthorityCodeException noSuchAuthorityCode(final Class<?> type, final String code) { return new NoSuchAuthorityCodeException(resources().getString(Resources.Keys.NoSuchAuthorityCode_3, Constants.EPSG, type, code), Constants.EPSG, code, code); }
/** * Creates an exception for an unknown authority code. * This convenience method is provided for implementation of {@code createFoo(String)} methods. * * @param type the GeoAPI interface that was to be created (e.g. {@code CoordinateReferenceSystem.class}). * @param code the unknown authority code. * @return an exception initialized with an error message built from the specified information. */ private NoSuchAuthorityCodeException noSuchAuthorityCode(final Class<?> type, final String code) { return new NoSuchAuthorityCodeException(resources().getString(Resources.Keys.NoSuchAuthorityCode_3, Constants.EPSG, type, code), Constants.EPSG, code, code); }
/** * Ensures that this factory is not already building an object of the given code. * This method shall be followed by a {@code try ... finally} block like below: * * {@preformat java * ensureNoCycle(type, code); * try { * ... * } finally { * endOfRecursive(type, code); * } * } */ private void ensureNoCycle(final Class<?> type, final Integer code) throws FactoryException { if (safetyGuard.putIfAbsent(code, type) != null) { throw new FactoryException(resources().getString(Resources.Keys.RecursiveCreateCallForCode_2, type, code)); } }
/** * Ensures that this factory is not already building an object of the given code. * This method shall be followed by a {@code try ... finally} block like below: * * {@preformat java * ensureNoCycle(type, code); * try { * ... * } finally { * endOfRecursive(type, code); * } * } */ private void ensureNoCycle(final Class<?> type, final Integer code) throws FactoryException { if (JDK8.putIfAbsent(safetyGuard, code, type) != null) { throw new FactoryException(resources().getString(Resources.Keys.RecursiveCreateCallForCode_2, type, code)); } }
/** * Validates the set of axes after the validation of each individual axis. * * @param properties the properties given at construction time. */ private void validateAxes(final Map<String,?> properties) { int i = super.getDimension(); int n = i - 2; // Number of vertical axes allowed. while (--i >= 0) { final AxisDirection direction = super.getAxis(i).getDirection(); if (AxisDirections.isVertical(direction) && --n < 0) { throw new IllegalArgumentException(Resources.forProperties(properties).getString( Resources.Keys.IllegalAxisDirection_2, EllipsoidalCS.class, direction)); } } }
/** * Validates the set of axes after the validation of each individual axis. * * @param properties the properties given at construction time. */ private void validateAxes(final Map<String,?> properties) { int i = super.getDimension(); int n = i - 2; // Number of vertical axes allowed. while (--i >= 0) { final AxisDirection direction = super.getAxis(i).getDirection(); if (AxisDirections.isVertical(direction) && --n < 0) { throw new IllegalArgumentException(Resources.forProperties(properties).getString( Resources.Keys.IllegalAxisDirection_2, EllipsoidalCS.class, direction)); } } }
/** * Ensures that the given name array does not contain duplicate values. * * @param properties the properties given to the constructor, or {@code null} if unknown. */ private static void verifyNames(final Map<String,?> properties, final GeneralParameterDescriptor[] parameters) { for (int i=0; i<parameters.length; i++) { final GeneralParameterDescriptor parameter = parameters[i]; ArgumentChecks.ensureNonNullElement("parameters", i, parameter); final String name = parameter.getName().getCode(); for (int j=0; j<i; j++) { if (IdentifiedObjects.isHeuristicMatchForName(parameters[j], name)) { throw new InvalidParameterNameException(Resources.forProperties(properties).getString( Resources.Keys.DuplicatedParameterName_4, Verifier.getDisplayName(parameters[j]), j, name, i), name); } } } }
/** * Ensures that the given name array does not contain duplicate values. * * @param properties the properties given to the constructor, or {@code null} if unknown. */ private static void verifyNames(final Map<String,?> properties, final GeneralParameterDescriptor[] parameters) { for (int i=0; i<parameters.length; i++) { final GeneralParameterDescriptor parameter = parameters[i]; ArgumentChecks.ensureNonNullElement("parameters", i, parameter); final String name = parameter.getName().getCode(); for (int j=0; j<i; j++) { if (IdentifiedObjects.isHeuristicMatchForName(parameters[j], name)) { throw new InvalidParameterNameException(Resources.forProperties(properties).getString( Resources.Keys.DuplicatedParameterName_4, Verifier.getDisplayName(parameters[j]), j, name, i), name); } } } }