You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/09/28 13:39:03 UTC
svn commit: r1762664 - in
/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources:
Errors.java Messages.java ResourceInternationalString.java Vocabulary.java
Author: desruisseaux
Date: Wed Sep 28 13:39:02 2016
New Revision: 1762664
URL: http://svn.apache.org/viewvc?rev=1762664&view=rev
Log:
Allows ResourceInternationalString to be subclasses outside the org.apache.sis.util.resources package.
Not that this is still an internal API (excluded from javadoc), even if the package name does not contain the "internal" word.
Opportunistic javadoc formatting.
Modified:
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1762664&r1=1762663&r2=1762664&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Sep 28 13:39:02 2016
@@ -1413,10 +1413,10 @@ public final class Errors extends Indexe
private static final class International extends ResourceInternationalString {
private static final long serialVersionUID = -5355796215044405012L;
- International(short key) {super(key);}
- International(short key, Object args) {super(key, args);}
- @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
- @Override IndexedResourceBundle getBundle(final Locale locale) {
+ International(short key) {super(key);}
+ International(short key, Object args) {super(key, args);}
+ @Override protected KeyConstants getKeyConstants() {return Keys.INSTANCE;}
+ @Override protected IndexedResourceBundle getBundle(final Locale locale) {
return getResources(locale);
}
}
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1762664&r1=1762663&r2=1762664&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] Wed Sep 28 13:39:02 2016
@@ -406,10 +406,10 @@ public final class Messages extends Inde
private static final class International extends ResourceInternationalString {
private static final long serialVersionUID = 4553487496835099424L;
- International(short key) {super(key);}
- International(short key, Object args) {super(key, args);}
- @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
- @Override IndexedResourceBundle getBundle(final Locale locale) {
+ International(short key) {super(key);}
+ International(short key, Object args) {super(key, args);}
+ @Override protected KeyConstants getKeyConstants() {return Keys.INSTANCE;}
+ @Override protected IndexedResourceBundle getBundle(final Locale locale) {
return getResources(locale);
}
}
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java?rev=1762664&r1=1762663&r2=1762664&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] Wed Sep 28 13:39:02 2016
@@ -39,11 +39,11 @@ import java.util.Objects;
* This base class is immutable and thus inherently thread-safe.
*
* @author Martin Desruisseaux (Geomatys)
- * @since 0.3
- * @version 0.4
+ * @since 0.8
+ * @version 0.8
* @module
*/
-abstract class ResourceInternationalString extends AbstractInternationalString implements Serializable {
+public abstract class ResourceInternationalString extends AbstractInternationalString implements Serializable {
/**
* Serial number for inter-operability with different versions.
*/
@@ -71,9 +71,9 @@ abstract class ResourceInternationalStri
/**
* Creates a new international string for the given key.
*
- * @param key The key for the resource to fetch.
+ * @param key the key for the resource to fetch.
*/
- ResourceInternationalString(final short key) {
+ protected ResourceInternationalString(final short key) {
this.key = key;
hasArguments = false;
arguments = null;
@@ -82,10 +82,10 @@ abstract class ResourceInternationalStri
/**
* Creates a new international string for the given key and arguments.
*
- * @param key The key for the resource to fetch.
- * @param arguments The argument(s).
+ * @param key the key for the resource to fetch.
+ * @param arguments the argument(s).
*/
- ResourceInternationalString(final short key, final Object arguments) {
+ protected ResourceInternationalString(final short key, final Object arguments) {
this.key = key;
this.hasArguments = true;
this.arguments = arguments;
@@ -96,24 +96,24 @@ abstract class ResourceInternationalStri
* This is used at serialization time in order to serialize the constant name
* rather than its numeric value.
*
- * @return A handler for the constants declared in the inner {@code Keys} class.
+ * @return a handler for the constants declared in the inner {@code Keys} class.
*/
- abstract KeyConstants getKeyConstants();
+ protected abstract KeyConstants getKeyConstants();
/**
* Returns the resource bundle for the given locale.
*
- * @param locale The locale for which to get the resource bundle.
- * @return The resource bundle for the given locale.
+ * @param locale the locale for which to get the resource bundle.
+ * @return the resource bundle for the given locale.
*/
- abstract IndexedResourceBundle getBundle(final Locale locale);
+ protected abstract IndexedResourceBundle getBundle(final Locale locale);
/**
* Returns a string in the specified locale.
*
- * @param locale The desired locale for the string to be returned.
- * @return The string in the specified locale, or in a fallback locale.
- * @throws MissingResourceException is the key given to the constructor is invalid.
+ * @param locale the desired locale for the string to be returned.
+ * @return the string in the specified locale, or in a fallback locale.
+ * @throws MissingResourceException if the key given to the constructor is invalid.
*/
@Override
public final String toString(final Locale locale) throws MissingResourceException {
@@ -124,7 +124,7 @@ abstract class ResourceInternationalStri
/**
* Compares this international string with the specified object for equality.
*
- * @param object The object to compare with this international string.
+ * @param object the object to compare with this international string.
* @return {@code true} if the given object is equal to this string.
*/
@Override
@@ -149,7 +149,7 @@ abstract class ResourceInternationalStri
/**
* Serializes this international string using the key name rather than numerical value.
*
- * @param out The output stream where to serialize this object.
+ * @param out the output stream where to serialize this object.
* @throws IOException If an I/O error occurred while writing.
*/
private void writeObject(final ObjectOutputStream out) throws IOException {
@@ -160,9 +160,9 @@ abstract class ResourceInternationalStri
/**
* Deserializes an object serialized by {@link #writeObject(ObjectOutputStream)}.
*
- * @param in The input stream from which to deserialize an object.
- * @throws IOException If an I/O error occurred while reading or if the stream contains invalid data.
- * @throws ClassNotFoundException If the class serialized on the stream is not on the classpath.
+ * @param in the input stream from which to deserialize an object.
+ * @throws IOException if an I/O error occurred while reading or if the stream contains invalid data.
+ * @throws ClassNotFoundException if the class serialized on the stream is not on the classpath.
*/
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1762664&r1=1762663&r2=1762664&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Wed Sep 28 13:39:02 2016
@@ -695,10 +695,10 @@ public final class Vocabulary extends In
private static final class International extends ResourceInternationalString {
private static final long serialVersionUID = -5423999784169092823L;
- International(short key) {super(key);}
- International(short key, Object args) {super(key, args);}
- @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
- @Override IndexedResourceBundle getBundle(final Locale locale) {
+ International(short key) {super(key);}
+ International(short key, Object args) {super(key, args);}
+ @Override protected KeyConstants getKeyConstants() {return Keys.INSTANCE;}
+ @Override protected IndexedResourceBundle getBundle(final Locale locale) {
return getResources(locale);
}
}