scolebourne 2004/03/20 12:07:02
Modified: convert/src/java/org/apache/commons/convert/conversion
AbstractConversionFactory.java
AbstractConversion.java DefaultValueDecorator.java
convert/src/java/org/apache/commons/convert Conversion.java
ConversionFactory.java Converter.java
ConvertUtils.java ConversionRegistry.java
Added: convert/src/java/org/apache/commons/convert/conversion
package.html
convert/src/java/org/apache/commons/convert package.html
Log:
Javadoc fixes via checkstyle
Revision Changes Path
1.2 +8 -3
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/AbstractConversionFactory.java
Index: AbstractConversionFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/AbstractConversionFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractConversionFactory.java 20 Mar 2004 19:17:34 -0000 1.1
+++ AbstractConversionFactory.java 20 Mar 2004 20:07:02 -0000 1.2
@@ -45,6 +45,9 @@
/**
* Restricted constructor.
+ *
+ * @param baseFromType the base of the class hierarchy to convert from
+ * @param toType the type to convert to
*/
protected AbstractConversionFactory(Class baseFromType, Class toType) {
super();
@@ -108,10 +111,11 @@
*
* @param value the input value to be converted, pre-checked to not be null
* @param converter the converter being used, not null
+ * @return the converted value
* @throws Exception if conversion fails, use ConversionException if creating
* a new exception, otherwise just allow exceptions to be thrown
*/
- protected abstract Object convertValue(Object value, Converter converter);
+ protected abstract Object convertValue(Object value, Converter converter)
throws Exception;
//-----------------------------------------------------------------------
/**
@@ -195,10 +199,11 @@
*
* @param value the input value to be converted, pre-checked to not be null
* @param converter the converter being used, not null
+ * @return the converted value
* @throws Exception if conversion fails, use ConversionException if
creating
* a new exception, otherwise just allow exceptions to be thrown
*/
- protected Object convertValue(Object value, Converter converter) {
+ protected Object convertValue(Object value, Converter converter) throws
Exception {
return factory.convertValue(value, converter);
}
}
1.2 +5 -3
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/AbstractConversion.java
Index: AbstractConversion.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/AbstractConversion.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractConversion.java 20 Mar 2004 19:17:34 -0000 1.1
+++ AbstractConversion.java 20 Mar 2004 20:07:02 -0000 1.2
@@ -26,7 +26,7 @@
* in the subclass.
* <p>
* To implement a conversion from a single class, simply extend this class and
- * implement the [EMAIL PROTECTED] #convert(Object, Converter)} method. To
implement a
+ * implement the [EMAIL PROTECTED] #convertValue(Object, Converter)} method. To
implement a
* conversion from a class and its subclasses, use [EMAIL PROTECTED]
AbstractConversionFactory}.
*
* @author Stephen Colebourne
@@ -64,6 +64,7 @@
*
* @param value the input value to be converted, may be null
* @param converter the converter being used, not null
+ * @return the converted value
* @throws Exception if conversion fails, use ConversionException if creating
* a new exception, otherwise just allow exceptions to be thrown
*/
@@ -79,10 +80,11 @@
*
* @param value the input value to be converted, pre-checked to not be null
* @param converter the converter being used, not null
+ * @return the converted value
* @throws Exception if conversion fails, use ConversionException if creating
* a new exception, otherwise just allow exceptions to be thrown
*/
- protected Object convertValue(Object value, Converter converter) {
+ protected Object convertValue(Object value, Converter converter) throws
Exception {
throw new UnsupportedOperationException("Not implemented");
}
1.2 +12 -8
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/DefaultValueDecorator.java
Index: DefaultValueDecorator.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/DefaultValueDecorator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultValueDecorator.java 20 Mar 2004 19:17:34 -0000 1.1
+++ DefaultValueDecorator.java 20 Mar 2004 20:07:02 -0000 1.2
@@ -176,7 +176,7 @@
/**
* Abstract base class for default value decorators.
*/
- static abstract class AbstractDefaultConversion implements Conversion {
+ abstract static class AbstractDefaultConversion implements Conversion {
/** The decorated conversion */
private final Conversion conversion;
@@ -265,6 +265,8 @@
* @param value the object to be converted
* @param converter the associated converter
* @return the result of the conversion
+ * @throws Exception if conversion fails, use ConversionException if
creating
+ * a new exception, otherwise just allow exceptions to be thrown
*/
public Object convert(Object value, Converter converter) throws Exception {
Object result = getDecoratedConversion().convert(value, converter);
@@ -298,6 +300,8 @@
* @param value the object to be converted
* @param converter the associated converter
* @return the result of the conversion
+ * @throws Exception if conversion fails, use ConversionException if
creating
+ * a new exception, otherwise just allow exceptions to be thrown
*/
public Object convert(Object value, Converter converter) throws Exception {
if (value == null) {
@@ -384,7 +388,7 @@
/**
* Implement the default null result behaviour.
*/
- static abstract class AbstractDefaultConversionFactory implements
ConversionFactory {
+ abstract static class AbstractDefaultConversionFactory implements
ConversionFactory {
/** The decorated factory */
private final ConversionFactory factory;
@@ -434,7 +438,7 @@
* Creates a new decorated conversion.
*
* @param conversion the conversion to decorate
- * @param object the default value
+ * @param defaultValue the default value
* @return a new decorated conversion
*/
protected abstract Conversion createConversion(Conversion conversion,
Object defaultValue);
@@ -478,7 +482,7 @@
* Creates a new decorated conversion.
*
* @param conversion the conversion to decorate
- * @param object the default value
+ * @param defaultValue the default value
* @return a new decorated conversion
*/
protected Conversion createConversion(Conversion conversion, Object
defaultValue) {
@@ -506,7 +510,7 @@
* Creates a new decorated conversion.
*
* @param conversion the conversion to decorate
- * @param object the default value
+ * @param defaultValue the default value
* @return a new decorated conversion
*/
protected Conversion createConversion(Conversion conversion, Object
defaultValue) {
@@ -534,7 +538,7 @@
* Creates a new decorated conversion.
*
* @param conversion the conversion to decorate
- * @param object the default value
+ * @param defaultValue the default value
* @return a new decorated conversion
*/
protected Conversion createConversion(Conversion conversion, Object
defaultValue) {
@@ -562,7 +566,7 @@
* Creates a new decorated conversion.
*
* @param conversion the conversion to decorate
- * @param object the default value
+ * @param defaultValue the default value
* @return a new decorated conversion
*/
protected Conversion createConversion(Conversion conversion, Object
defaultValue) {
1.1
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/conversion/package.html
Index: package.html
===================================================================
<body>
<p>
Implementations of <code>Conversion</code> and <code>ConversionFactory</code>.
</p>
</body>
1.2 +5 -4
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/Conversion.java
Index: Conversion.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/Conversion.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Conversion.java 20 Mar 2004 19:17:33 -0000 1.1
+++ Conversion.java 20 Mar 2004 20:07:02 -0000 1.2
@@ -33,23 +33,24 @@
*
* @param value the value to be converted, read only, may be null
* @param converter the converter being used, not null
+ * @return the converted value
* @throws Exception if conversion fails, use ConversionException if creating
* a new exception, otherwise just allow exceptions to be thrown
*/
- public Object convert(Object value, Converter converter) throws Exception;
+ Object convert(Object value, Converter converter) throws Exception;
/**
* The type to convert from.
*
* @return the Class object representing the class to convert to
*/
- public Class getFromType();
+ Class getFromType();
/**
* The type to convert to.
*
* @return the Class object representing the class to convert from
*/
- public Class getToType();
+ Class getToType();
}
1.2 +3 -3
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/ConversionFactory.java
Index: ConversionFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/ConversionFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConversionFactory.java 20 Mar 2004 19:17:33 -0000 1.1
+++ ConversionFactory.java 20 Mar 2004 20:07:02 -0000 1.2
@@ -38,7 +38,7 @@
* @param toType th type to convert to, may be null
* @return a value between 0 and 100 inclusive, 0 means no match, 100 perfact
match
*/
- public int getMatchPercent(Object value, Class fromType, Class toType);
+ int getMatchPercent(Object value, Class fromType, Class toType);
/**
* Create a conversion object for the conversion.
@@ -52,6 +52,6 @@
* @param toType th type to convert to, may be null
* @return a Conversion object for repeatedly performing conversions
*/
- public Conversion getInstance(Object value, Class fromType, Class toType);
+ Conversion getInstance(Object value, Class fromType, Class toType);
}
1.6 +7 -1
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/Converter.java
Index: Converter.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/Converter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Converter.java 20 Mar 2004 19:17:33 -0000 1.5
+++ Converter.java 20 Mar 2004 20:07:02 -0000 1.6
@@ -76,6 +76,7 @@
* @param value the input value to be converted
* @param fromClass the class to convert from, useful if null passed in
* @param toClass the class to convert to
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public Object convert(Object value, Class fromClass, Class toClass) {
@@ -88,6 +89,7 @@
*
* @param value the input value to be converted
* @param toClass the class to convert to
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public Object convert(Object value, Class toClass) {
@@ -99,6 +101,7 @@
*
* @param value the input value to be converted
* @param fromClass the class to convert from, useful if null passed in
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public String convertToString(Object value, Class fromClass) {
@@ -109,6 +112,7 @@
* Convert the specified input object into a <code>String</code>.
*
* @param value the input value to be converted
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public String convertToString(Object value) {
@@ -124,6 +128,7 @@
* @param value the input value to be converted
* @param fromClass the class to convert from, useful if null passed in
* @param toClass the class to convert to
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
protected Object doConversion(Object value, Class fromClass, Class toClass) {
@@ -143,6 +148,7 @@
* @param conversion the conversion to use
* @param value the value to convert
* @return the converted value
+ * @throws ConversionException (runtime) if conversion fails
*/
protected Object doConversion(Conversion conversion, Object value) {
try {
1.7 +6 -44
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/ConvertUtils.java
Index: ConvertUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/ConvertUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConvertUtils.java 20 Mar 2004 19:17:33 -0000 1.6
+++ ConvertUtils.java 20 Mar 2004 20:07:02 -0000 1.7
@@ -31,7 +31,7 @@
/** The default Converter, private to prevent subclasses altering the default */
private static final Converter DEFAULT = new Converter(true);
-
+
/**
* Restricted constructor.
* The main access to this class is via static methods, and it is not intended
@@ -49,6 +49,7 @@
* @param value the input value to be converted
* @param fromClass the class to convert from, useful if null passed in
* @param toClass the class to convert to
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public static Object convert(Object value, Class fromClass, Class toClass) {
@@ -61,6 +62,7 @@
*
* @param value the input value to be converted
* @param toClass the class to convert to
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public static Object convert(Object value, Class toClass) {
@@ -72,6 +74,7 @@
*
* @param value the input value to be converted
* @param fromClass the class to convert from, useful if null passed in
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public static String convertToString(Object value, Class fromClass) {
@@ -82,52 +85,11 @@
* Convert the specified input object into a <code>String</code>.
*
* @param value the input value to be converted
+ * @return the converted value
* @throws ConversionException (runtime) if conversion fails
*/
public static String convertToString(Object value) {
return DEFAULT.convertToString(value);
}
-
-// /**
-// * Convert the specified input object into a primitive <code>int</code>.
-// *
-// * @param value the input value to be converted
-// * @throws ConversionException (runtime) if conversion fails
-// */
-// public static int convertToInt(Object value) {
-// return DEFAULT.convertToInt(value);
-// }
-//
-// /**
-// * Convert the specified input object into a primitive <code>int</code>.
-// *
-// * @param value the input value to be converted
-// * @param fromClass the class to convert from, useful if null passed in
-// * @throws ConversionException (runtime) if conversion fails
-// */
-// public static int convertToInt(Object value, Class fromClass) {
-// return DEFAULT.convertToInt(value, fromClass);
-// }
-//
-// /**
-// * Convert the specified input object into a primitive <code>boolean</code>.
-// *
-// * @param value the input value to be converted
-// * @throws ConversionException (runtime) if conversion fails
-// */
-// public static boolean convertToBoolean(Object value) {
-// return DEFAULT.convertToBoolean(value);
-// }
-//
-// /**
-// * Convert the specified input object into a primitive <code>boolean</code>.
-// *
-// * @param value the input value to be converted
-// * @param fromClass the class to convert from, useful if null passed in
-// * @throws ConversionException (runtime) if conversion fails
-// */
-// public static boolean convertToBoolean(Object value, Class fromClass) {
-// return DEFAULT.convertToBoolean(value, fromClass);
-// }
}
1.2 +2 -1
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/ConversionRegistry.java
Index: ConversionRegistry.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/ConversionRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConversionRegistry.java 20 Mar 2004 19:17:33 -0000 1.1
+++ ConversionRegistry.java 20 Mar 2004 20:07:02 -0000 1.2
@@ -120,6 +120,7 @@
* factories are used to search for and create a conversion. If no suitable
* factory is found then <code>null</code> is returned.
*
+ * @param value the value that will be converted, read only and not to be
stored
* @param fromType the type to convert from
* @param toType the type to convert to
* @return the best matching conversion, null if no match
1.1
jakarta-commons-sandbox/convert/src/java/org/apache/commons/convert/package.html
Index: package.html
===================================================================
<body>
<p>
The main API for using the convert project.
</p>
<p>
This package contains the main API of the convert project.
<ul>
<li><code>Conversion</code> is the simple interface that converts from one type to
another.</li>
<li><code>ConversionFactory</code> allows conversions to be created for class
hierarchies
and in other situations where a single hard-coded conversion is inappropriate.</li>
<li><code>ConversionRegistry</code> is the manager class that stores a list of
registered
conversions and factories and picks the best one for the job.</li>
<li><code>Convertor</code> provides a simple interface onto the registry.</li>
<li><code>ConvertUtils</code> is a simple static utility class that has a fixed
default set of conversions.</li>
</ul>
</p>
</body>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]