Add since tags for 2.1

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2004-10-08 00:11:00 +00:00
parent 16938363f6
commit c9e1d29360
10 changed files with 61 additions and 11 deletions

View File

@ -44,7 +44,7 @@
* @author <a href="mailto:equinus100@hotmail.com">Ashwin S</a>
* @author Maarten Coene
* @since 2.0
* @version $Id: ArrayUtils.java,v 1.46 2004/08/15 02:12:51 bayard Exp $
* @version $Id: ArrayUtils.java,v 1.47 2004/10/08 00:11:00 scolebourne Exp $
*/
public class ArrayUtils {
@ -427,6 +427,7 @@ public static boolean[] clone(boolean[] array) {
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static Object[] subarray(Object[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -465,6 +466,7 @@ public static Object[] subarray(Object[] array, int startIndexInclusive, int end
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static long[] subarray(long[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -503,6 +505,7 @@ public static long[] subarray(long[] array, int startIndexInclusive, int endInde
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static int[] subarray(int[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -541,6 +544,7 @@ public static int[] subarray(int[] array, int startIndexInclusive, int endIndexE
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static short[] subarray(short[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -579,6 +583,7 @@ public static short[] subarray(short[] array, int startIndexInclusive, int endIn
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static char[] subarray(char[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -617,6 +622,7 @@ public static char[] subarray(char[] array, int startIndexInclusive, int endInde
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static byte[] subarray(byte[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -655,6 +661,7 @@ public static byte[] subarray(byte[] array, int startIndexInclusive, int endInde
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static double[] subarray(double[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -693,6 +700,7 @@ public static double[] subarray(double[] array, int startIndexInclusive, int end
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static float[] subarray(float[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -731,6 +739,7 @@ public static float[] subarray(float[] array, int startIndexInclusive, int endIn
* array length.
* @return a new array containing the elements between
* the start and end indices.
* @since 2.1
*/
public static boolean[] subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
@ -937,6 +946,7 @@ public static boolean isSameLength(boolean[] array1, boolean[] array2) {
* @param array the array to retrieve the length from, may be null
* @return The length of the array, or <code>0</code> if the array is <code>null</code>
* @throws IllegalArgumentException if the object arguement is not an array.
* @since 2.1
*/
public static int getLength(Object array) {
if (array == null) {
@ -963,6 +973,7 @@ public static int getLength(Object array) {
* @param array the array to return the last index for, may be null
* @return the last index, -1 if empty or null
* @throws IllegalArgumentException if the object arguement is not an array.
* @since 2.1
*/
public static int lastIndex(Object array) {
return ArrayUtils.getLength(array) - 1;
@ -1637,6 +1648,7 @@ public static boolean contains(short[] array, short valueToFind) {
* @param valueToFind the value to find
* @return the index of the value within the array,
* <code>-1</code> if not found or <code>null</code> array input
* @since 2.1
*/
public static int indexOf(char[] array, char valueToFind) {
return indexOf(array, valueToFind, 0);
@ -1655,6 +1667,7 @@ public static int indexOf(char[] array, char valueToFind) {
* @param startIndex the index to start searching at
* @return the index of the value within the array,
* <code>-1</code> if not found or <code>null</code> array input
* @since 2.1
*/
public static int indexOf(char[] array, char valueToFind, int startIndex) {
if (array == null) {
@ -1680,6 +1693,7 @@ public static int indexOf(char[] array, char valueToFind, int startIndex) {
* @param valueToFind the object to find
* @return the last index of the value within the array,
* <code>-1</code> if not found or <code>null</code> array input
* @since 2.1
*/
public static int lastIndexOf(char[] array, char valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
@ -1698,6 +1712,7 @@ public static int lastIndexOf(char[] array, char valueToFind) {
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
* <code>-1</code> if not found or <code>null</code> array input
* @since 2.1
*/
public static int lastIndexOf(char[] array, char valueToFind, int startIndex) {
if (array == null) {
@ -1724,6 +1739,7 @@ public static int lastIndexOf(char[] array, char valueToFind, int startIndex) {
* @param array the array to search through
* @param valueToFind the value to find
* @return <code>true</code> if the array contains the object
* @since 2.1
*/
public static boolean contains(char[] array, char valueToFind) {
return (indexOf(array, valueToFind) != -1);

View File

@ -32,7 +32,7 @@
* @author Gary Gregory
* @author Norm Deane
* @since 2.0
* @version $Id: ClassUtils.java,v 1.30 2004/06/30 18:33:58 ggregory Exp $
* @version $Id: ClassUtils.java,v 1.31 2004/10/08 00:10:59 scolebourne Exp $
*/
public class ClassUtils {
@ -499,6 +499,7 @@ public static boolean isAssignable(Class cls, Class toClass) {
* @param cls the class to convert, may be null
* @return the wrapper class for <code>cls</code> or <code>cls</code> if
* <code>cls</code> is not a primitive. <code>null</code> if null input.
* @since 2.1
*/
public static Class primitiveToWrapper(Class cls) {
Class convertedClass = cls;
@ -516,6 +517,7 @@ public static Class primitiveToWrapper(Class cls) {
* @return an array which contains for each given class, the wrapper class or
* the original class if class is not a primitive. <code>null</code> if null input.
* Empty array if an empty array passed in.
* @since 2.1
*/
public static Class[] primitivesToWrappers(Class[] classes) {
if (classes == null) {
@ -523,7 +525,7 @@ public static Class[] primitivesToWrappers(Class[] classes) {
}
if (classes.length == 0) {
return ArrayUtils.EMPTY_CLASS_ARRAY;
return classes;
}
Class[] convertedClasses = new Class[classes.length];

View File

@ -33,7 +33,7 @@
* @author Tetsuya Kaneuchi
* @author Rafal Krupinski
* @since 1.0
* @version $Id: SystemUtils.java,v 1.35 2004/08/30 21:21:18 ggregory Exp $
* @version $Id: SystemUtils.java,v 1.36 2004/10/08 00:10:59 scolebourne Exp $
*/
public class SystemUtils {
@ -1249,6 +1249,7 @@ public static boolean isJavaAwtHeadless() {
* <code>checkPropertyAccess</code> method doesn't allow
* access to the specified system property.
* @see System#getProperty(String)
* @since 2.1
*/
public static File getJavaHome() {
return new File(System.getProperty(JAVA_HOME_KEY));
@ -1262,6 +1263,7 @@ public static File getJavaHome() {
* <code>checkPropertyAccess</code> method doesn't allow
* access to the specified system property.
* @see System#getProperty(String)
* @since 2.1
*/
public static File getJavaIoTmpDir() {
return new File(System.getProperty(JAVA_IO_TMPDIR_KEY));
@ -1275,6 +1277,7 @@ public static File getJavaIoTmpDir() {
* <code>checkPropertyAccess</code> method doesn't allow
* access to the specified system property.
* @see System#getProperty(String)
* @since 2.1
*/
public static File getUserDir() {
return new File(System.getProperty(USER_DIR_KEY));
@ -1288,6 +1291,7 @@ public static File getUserDir() {
* <code>checkPropertyAccess</code> method doesn't allow
* access to the specified system property.
* @see System#getProperty(String)
* @since 2.1
*/
public static File getUserHome() {
return new File(System.getProperty(USER_HOME_KEY));

View File

@ -74,7 +74,7 @@
* @author Pete Gieser
* @author Arun Mammen Thomas
* @since 1.0
* @version $Id: EqualsBuilder.java,v 1.26 2004/08/26 05:46:45 ggregory Exp $
* @version $Id: EqualsBuilder.java,v 1.27 2004/10/08 00:07:59 scolebourne Exp $
*/
public class EqualsBuilder {
@ -747,6 +747,7 @@ public boolean isEquals() {
* Sets the <code>isEquals</code> value.
*
* @param isEquals The value to set.
* @since 2.1
*/
protected void setEquals(boolean isEquals) {
this.isEquals = isEquals;

View File

@ -25,7 +25,7 @@
/**
* <p>
* Assists in implementing {@link Object#toString()}methods using reflection.
* Assists in implementing {@link Object#toString()} methods using reflection.
* </p>
*
* <p>
@ -294,6 +294,7 @@ public static String toString(Object object, ToStringStyle style, boolean output
* @return the String result
* @throws IllegalArgumentException
* if the Object is <code>null</code>
* @since 2.1
*/
public static String toString(Object object, ToStringStyle style, boolean outputTransients, boolean outputStatics) {
return toString(object, style, outputTransients, outputStatics, null);
@ -346,6 +347,7 @@ public static String toString(Object object, ToStringStyle style, boolean output
* @return the String result
* @throws IllegalArgumentException
* if the Object is <code>null</code>
* @since 2.1
*/
public static String toString(Object object, ToStringStyle style, boolean outputTransients, boolean outputStatics,
Class reflectUpToClass) {
@ -397,6 +399,7 @@ public static String toString(Object object, ToStringStyle style, boolean output
* @return the String result
* @throws IllegalArgumentException
* if the Object is <code>null</code>
* @since 2.1
*/
public static String toString(Object object, ToStringStyle style, boolean outputTransients, Class reflectUpToClass) {
return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients).toString();
@ -542,6 +545,7 @@ public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffe
* whether to include transient fields
* @param outputStatics
* whether to include static fields
* @since 2.1
*/
public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer, Class reflectUpToClass,
boolean outputTransients, boolean outputStatics) {
@ -690,6 +694,7 @@ protected Object getValue(Field field) throws IllegalArgumentException, IllegalA
* </p>
*
* @return Whether or not to append static fields.
* @since 2.1
*/
public boolean isAppendStatics() {
return this.appendStatics;
@ -737,6 +742,7 @@ void registerObject() {
*
* @param appendStatics
* Whether or not to append static fields.
* @since 2.1
*/
public void setAppendStatics(boolean appendStatics) {
this.appendStatics = appendStatics;

View File

@ -48,7 +48,7 @@
* @author Gary Gregory
* @author Pete Gieser
* @since 1.0
* @version $Id: ToStringStyle.java,v 1.32 2004/07/01 17:40:10 ggregory Exp $
* @version $Id: ToStringStyle.java,v 1.33 2004/10/08 00:07:59 scolebourne Exp $
*/
public abstract class ToStringStyle implements Serializable {
@ -69,6 +69,7 @@ public abstract class ToStringStyle implements Serializable {
/**
* The short prefix toString style.
* @since 2.1
*/
public static final ToStringStyle SHORT_PREFIX_STYLE = new ShortPrefixToStringStyle();

View File

@ -33,7 +33,7 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author <a href="mailto:fredrik@westermarck.com">Fredrik Westermarck</a>
* @since 2.0
* @version $Id: NumberUtils.java,v 1.18 2004/02/18 22:56:13 ggregory Exp $
* @version $Id: NumberUtils.java,v 1.19 2004/10/08 00:07:59 scolebourne Exp $
*/
public class NumberUtils {
@ -122,6 +122,7 @@ public static int stringToInt(String str) {
* @param str the string to convert, may be null
* @return the int represented by the string, or <code>zero</code> if
* conversion fails
* @since 2.1
*/
public static int toInt(String str) {
return toInt(str, 0);
@ -164,6 +165,7 @@ public static int stringToInt(String str, int defaultValue) {
* @param str the string to convert, may be null
* @param defaultValue the default value
* @return the int represented by the string, or the default if conversion fails
* @since 2.1
*/
public static int toInt(String str, int defaultValue) {
if(str == null) {

View File

@ -31,7 +31,7 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Phil Steitz
* @since 2.0
* @version $Id: DateUtils.java,v 1.30 2004/09/27 03:14:15 bayard Exp $
* @version $Id: DateUtils.java,v 1.31 2004/10/08 00:09:01 scolebourne Exp $
*/
public class DateUtils {
@ -41,18 +41,22 @@ public class DateUtils {
public static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone("GMT");
/**
* Number of milliseconds in a standard second.
* @since 2.1
*/
public static final long MILLIS_PER_SECOND = 1000;
/**
* Number of milliseconds in a standard minute.
* @since 2.1
*/
public static final long MILLIS_PER_MINUTE = 60 * MILLIS_PER_SECOND;
/**
* Number of milliseconds in a standard hour.
* @since 2.1
*/
public static final long MILLIS_PER_HOUR = 60 * MILLIS_PER_MINUTE;
/**
* Number of milliseconds in a standard day.
* @since 2.1
*/
public static final long MILLIS_PER_DAY = 24 * MILLIS_PER_HOUR;
@ -125,6 +129,7 @@ public DateUtils() {
* @param cal2 the second calendar, not null
* @return true if they represent the same day
* @throws IllegalArgumentException if either calendar is <code>null</code>
* @since 2.1
*/
public static boolean isSameDay(Calendar cal1, Calendar cal2) {
if (cal1 == null || cal2 == null) {

View File

@ -61,7 +61,7 @@
* @author Stephen Colebourne
* @author Nikolay Metchev
* @since 2.0
* @version $Id: FastDateFormat.java,v 1.21 2004/09/12 05:03:26 bayard Exp $
* @version $Id: FastDateFormat.java,v 1.22 2004/10/08 00:09:01 scolebourne Exp $
*/
public class FastDateFormat extends Format {
// A lot of the speed in this class comes from caching, but some comes
@ -219,6 +219,7 @@ public static synchronized FastDateFormat getInstance(String pattern, TimeZone t
* @return a localized standard date formatter
* @throws IllegalArgumentException if the Locale has no date
* pattern defined
* @since 2.1
*/
public static FastDateFormat getDateInstance(int style) {
return getDateInstance(style, null, null);
@ -233,6 +234,7 @@ public static FastDateFormat getDateInstance(int style) {
* @return a localized standard date formatter
* @throws IllegalArgumentException if the Locale has no date
* pattern defined
* @since 2.1
*/
public static FastDateFormat getDateInstance(int style, Locale locale) {
return getDateInstance(style, null, locale);
@ -248,6 +250,7 @@ public static FastDateFormat getDateInstance(int style, Locale locale) {
* @return a localized standard date formatter
* @throws IllegalArgumentException if the Locale has no date
* pattern defined
* @since 2.1
*/
public static FastDateFormat getDateInstance(int style, TimeZone timeZone) {
return getDateInstance(style, timeZone, null);
@ -301,6 +304,7 @@ public static synchronized FastDateFormat getDateInstance(int style, TimeZone ti
* @return a localized standard time formatter
* @throws IllegalArgumentException if the Locale has no time
* pattern defined
* @since 2.1
*/
public static FastDateFormat getTimeInstance(int style) {
return getTimeInstance(style, null, null);
@ -315,6 +319,7 @@ public static FastDateFormat getTimeInstance(int style) {
* @return a localized standard time formatter
* @throws IllegalArgumentException if the Locale has no time
* pattern defined
* @since 2.1
*/
public static FastDateFormat getTimeInstance(int style, Locale locale) {
return getTimeInstance(style, null, locale);
@ -330,6 +335,7 @@ public static FastDateFormat getTimeInstance(int style, Locale locale) {
* @return a localized standard time formatter
* @throws IllegalArgumentException if the Locale has no time
* pattern defined
* @since 2.1
*/
public static FastDateFormat getTimeInstance(int style, TimeZone timeZone) {
return getTimeInstance(style, timeZone, null);
@ -385,6 +391,7 @@ public static synchronized FastDateFormat getTimeInstance(int style, TimeZone ti
* @return a localized standard date/time formatter
* @throws IllegalArgumentException if the Locale has no date/time
* pattern defined
* @since 2.1
*/
public static FastDateFormat getDateTimeInstance(
int dateStyle, int timeStyle) {
@ -401,6 +408,7 @@ public static FastDateFormat getDateTimeInstance(
* @return a localized standard date/time formatter
* @throws IllegalArgumentException if the Locale has no date/time
* pattern defined
* @since 2.1
*/
public static FastDateFormat getDateTimeInstance(
int dateStyle, int timeStyle, Locale locale) {
@ -418,6 +426,7 @@ public static FastDateFormat getDateTimeInstance(
* @return a localized standard date/time formatter
* @throws IllegalArgumentException if the Locale has no date/time
* pattern defined
* @since 2.1
*/
public static FastDateFormat getDateTimeInstance(
int dateStyle, int timeStyle, TimeZone timeZone) {
@ -787,6 +796,7 @@ public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition po
*
* @param millis the millisecond value to format
* @return the formatted string
* @since 2.1
*/
public String format(long millis) {
return format(new Date(millis));
@ -821,6 +831,7 @@ public String format(Calendar calendar) {
* @param millis the millisecond value to format
* @param buf the buffer to format into
* @return the specified string buffer
* @since 2.1
*/
public StringBuffer format(long millis, StringBuffer buf) {
return format(new Date(millis), buf);

View File

@ -46,7 +46,7 @@
* @author Henri Yandell
* @author Stephen Colebourne
* @since 2.0
* @version $Id: StopWatch.java,v 1.9 2004/07/25 07:31:36 bayard Exp $
* @version $Id: StopWatch.java,v 1.10 2004/10/08 00:09:01 scolebourne Exp $
*/
public class StopWatch {
@ -226,6 +226,7 @@ public long getTime() {
* @return the split time in milliseconds
*
* @throws IllegalStateException if the StopWatch has not yet been split.
* @since 2.1
*/
public long getSplitTime() {
if(this.splitState != STATE_SPLIT) {
@ -253,6 +254,7 @@ public String toString() {
* <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.</p>
*
* @return the split time as a String
* @since 2.1
*/
public String toSplitString() {
return DurationFormatUtils.formatISO(getSplitTime());