directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r370807 [20/22] - in /directory/sandbox/trustin/mina-spi: ./ core/src/main/java/org/apache/mina/common/ core/src/main/java/org/apache/mina/common/support/ core/src/main/java/org/apache/mina/common/support/discovery/ core/src/main/java/org/a...
Date Fri, 20 Jan 2006 13:48:55 GMT
Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableDouble.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableDouble.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableDouble.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableDouble.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mina.common.support.lang.mutable;
+
+import org.apache.mina.common.support.lang.math.NumberUtils;
+
+/**
+ * A mutable <code>double</code> wrapper.
+ * 
+ * @see Double
+ * @since 2.1
+ * @version $Id$
+ */
+public class MutableDouble extends Number implements Comparable, Mutable {
+
+    /** Serialization lock. */
+    private static final long serialVersionUID = 1587163916L;
+
+    /** The mutable value. */
+    private double value;
+
+    /**
+     * Constructs a new MutableDouble with the default value of zero.
+     */
+    public MutableDouble() {
+        super();
+    }
+
+    /**
+     * Constructs a new MutableDouble with the specified value.
+     * 
+     * @param value
+     *            a value.
+     */
+    public MutableDouble(double value) {
+        super();
+        this.value = value;
+    }
+
+    /**
+     * Constructs a new MutableDouble with the specified value.
+     * 
+     * @param value
+     *            a value.
+     * @throws NullPointerException
+     *             if the object is null
+     */
+    public MutableDouble(Number value) {
+        super();
+        this.value = value.doubleValue();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value as a Double instance.
+     * 
+     * @return the value as a Double
+     */
+    public Object getValue() {
+        return new Double(this.value);
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value
+     *            the value to set
+     */
+    public void setValue(double value) {
+        this.value = value;
+    }
+
+    /**
+     * Sets the value from any Number instance.
+     * 
+     * @param value
+     *            the value to set
+     * @throws NullPointerException
+     *             if the object is null
+     * @throws ClassCastException
+     *             if the type is not a {@link Number}
+     */
+    public void setValue(Object value) {
+        setValue(((Number) value).doubleValue());
+    }
+
+    //-----------------------------------------------------------------------
+    // shortValue and bytValue rely on Number implementation
+    /**
+     * Returns the value of this MutableDouble as a int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    public int intValue() {
+        return (int) value;
+    }
+
+    /**
+     * Returns the value of this MutableDouble as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    public long longValue() {
+        return (long) value;
+    }
+
+    /**
+     * Returns the value of this MutableDouble as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    public float floatValue() {
+        return (float) value;
+    }
+
+    /**
+     * Returns the value of this MutableDouble as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    public double doubleValue() {
+        return value;
+    }
+
+    /**
+     * Checks whether the double value is the special NaN value.
+     * 
+     * @return true if NaN
+     */
+    public boolean isNaN() {
+        return Double.isNaN(value);
+    }
+
+    /**
+     * Checks whether the double value is infinite.
+     * 
+     * @return true if infinite
+     */
+    public boolean isInfinite() {
+        return Double.isInfinite(value);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Compares this object against the specified object. The result is <code>true</code> if and only if the argument
+     * is not <code>null</code> and is a <code>Double</code> object that represents a double that has the identical
+     * bit pattern to the bit pattern of the double represented by this object. For this purpose, two
+     * <code>double</code> values are considered to be the same if and only if the method
+     * {@link Double#doubleToLongBits(double)}returns the same long value when applied to each.
+     * <p>
+     * Note that in most cases, for two instances of class <code>Double</code>,<code>d1</code> and <code>d2</code>,
+     * the value of <code>d1.equals(d2)</code> is <code>true</code> if and only if <blockquote>
+     * 
+     * <pre>
+     *   d1.doubleValue()&nbsp;== d2.doubleValue()
+     * </pre>
+     * 
+     * </blockquote>
+     * <p>
+     * also has the value <code>true</code>. However, there are two exceptions:
+     * <ul>
+     * <li>If <code>d1</code> and <code>d2</code> both represent <code>Double.NaN</code>, then the
+     * <code>equals</code> method returns <code>true</code>, even though <code>Double.NaN==Double.NaN</code> has
+     * the value <code>false</code>.
+     * <li>If <code>d1</code> represents <code>+0.0</code> while <code>d2</code> represents <code>-0.0</code>,
+     * or vice versa, the <code>equal</code> test has the value <code>false</code>, even though
+     * <code>+0.0==-0.0</code> has the value <code>true</code>. This allows hashtables to operate properly.
+     * </ul>
+     * 
+     * @param obj
+     *            the object to compare with.
+     * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
+     */
+    public boolean equals(Object obj) {
+        return (obj instanceof MutableDouble)
+            && (Double.doubleToLongBits(((MutableDouble) obj).value) == Double.doubleToLongBits(value));
+    }
+
+    /**
+     * Returns a suitable hashcode for this mutable.
+     * 
+     * @return a suitable hashcode
+     */
+    public int hashCode() {
+        long bits = Double.doubleToLongBits(value);
+        return (int) (bits ^ (bits >>> 32));
+    }
+
+    /**
+     * Compares this mutable to another in ascending order.
+     * 
+     * @param obj
+     *            the mutable to compare to
+     * @return negative if this is less, zero if equal, positive if greater
+     * @throws ClassCastException if the argument is not a MutableDouble
+     */
+    public int compareTo(Object obj) {
+        MutableDouble other = (MutableDouble) obj;
+        double anotherVal = other.value;
+        return NumberUtils.compare(value, anotherVal);
+    }
+
+    /**
+     * Returns the String value of this mutable.
+     * 
+     * @return the mutable value as a string
+     */
+    public String toString() {
+        return String.valueOf(value);
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableDouble.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableFloat.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableFloat.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableFloat.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableFloat.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mina.common.support.lang.mutable;
+
+import org.apache.mina.common.support.lang.math.NumberUtils;
+
+/**
+ * A mutable <code>float</code> wrapper.
+ * 
+ * @see Float
+ * @since 2.1
+ * @version $Id$
+ */
+public class MutableFloat extends Number implements Comparable, Mutable {
+
+    /** Serialization lock. */
+    private static final long serialVersionUID = 5787169186L;
+
+    /** The mutable value. */
+    private float value;
+
+    /**
+     * Constructs a new MutableFloat with the default value of zero.
+     */
+    public MutableFloat() {
+        super();
+    }
+
+    /**
+     * Constructs a new MutableFloat with the specified value.
+     * 
+     * @param value
+     *            a value.
+     */
+    public MutableFloat(float value) {
+        super();
+        this.value = value;
+    }
+
+    /**
+     * Constructs a new MutableFloat with the specified value.
+     * 
+     * @param value
+     *            a value.
+     * @throws NullPointerException
+     *             if the object is null
+     */
+    public MutableFloat(Number value) {
+        super();
+        this.value = value.floatValue();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value as a Float instance.
+     * 
+     * @return the value as a Float
+     */
+    public Object getValue() {
+        return new Float(this.value);
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value
+     *            the value to set
+     */
+    public void setValue(float value) {
+        this.value = value;
+    }
+
+    /**
+     * Sets the value from any Number instance.
+     * 
+     * @param value
+     *            the value to set
+     * @throws NullPointerException
+     *             if the object is null
+     * @throws ClassCastException
+     *             if the type is not a {@link Number}
+     */
+    public void setValue(Object value) {
+        setValue(((Number) value).floatValue());
+    }
+
+    //-----------------------------------------------------------------------
+    // shortValue and bytValue rely on Number implementation
+    /**
+     * Returns the value of this MutableFloat as a int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    public int intValue() {
+        return (int) value;
+    }
+
+    /**
+     * Returns the value of this MutableFloat as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    public long longValue() {
+        return (long) value;
+    }
+
+    /**
+     * Returns the value of this MutableFloat as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    public float floatValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableFloat as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    public double doubleValue() {
+        return value;
+    }
+
+    /**
+     * Checks whether the float value is the special NaN value.
+     * 
+     * @return true if NaN
+     */
+    public boolean isNaN() {
+        return Float.isNaN(value);
+    }
+
+    /**
+     * Checks whether the float value is infinite.
+     * 
+     * @return true if infinite
+     */
+    public boolean isInfinite() {
+        return Float.isInfinite(value);
+    }
+
+    /**
+     * Compares this object against some other object. The result is <code>true</code> if and only if the argument is
+     * not <code>null</code> and is a <code>Float</code> object that represents a <code>float</code> that has the
+     * identical bit pattern to the bit pattern of the <code>float</code> represented by this object. For this
+     * purpose, two float values are considered to be the same if and only if the method
+     * {@link Float#floatToIntBits(float)}returns the same int value when applied to each.
+     * <p>
+     * Note that in most cases, for two instances of class <code>Float</code>,<code>f1</code> and <code>f2</code>,
+     * the value of <code>f1.equals(f2)</code> is <code>true</code> if and only if <blockquote>
+     * 
+     * <pre>
+     *   f1.floatValue() == f2.floatValue()
+     * </pre>
+     * 
+     * </blockquote>
+     * <p>
+     * also has the value <code>true</code>. However, there are two exceptions:
+     * <ul>
+     * <li>If <code>f1</code> and <code>f2</code> both represent <code>Float.NaN</code>, then the
+     * <code>equals</code> method returns <code>true</code>, even though <code>Float.NaN==Float.NaN</code> has
+     * the value <code>false</code>.
+     * <li>If <code>f1</code> represents <code>+0.0f</code> while <code>f2</code> represents <code>-0.0f</code>,
+     * or vice versa, the <code>equal</code> test has the value <code>false</code>, even though
+     * <code>0.0f==-0.0f</code> has the value <code>true</code>.
+     * </ul>
+     * This definition allows hashtables to operate properly.
+     * 
+     * @param obj
+     *            the object to be compared
+     * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
+     * @see java.lang.Float#floatToIntBits(float)
+     */
+    public boolean equals(Object obj) {
+        return (obj instanceof MutableFloat)
+            && (Float.floatToIntBits(((MutableFloat) obj).value) == Float.floatToIntBits(value));
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a suitable hashcode for this mutable.
+     * 
+     * @return a suitable hashcode
+     */
+    public int hashCode() {
+        return Float.floatToIntBits(value);
+    }
+
+    /**
+     * Compares this mutable to another in ascending order.
+     * 
+     * @param obj
+     *            the mutable to compare to
+     * @return negative if this is less, zero if equal, positive if greater
+     */
+    public int compareTo(Object obj) {
+        MutableFloat other = (MutableFloat) obj;
+        float anotherVal = other.value;
+        return NumberUtils.compare(value, anotherVal);
+    }
+
+    /**
+     * Returns the String value of this mutable.
+     * 
+     * @return the mutable value as a string
+     */
+    public String toString() {
+        return String.valueOf(value);
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableFloat.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableInt.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableInt.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableInt.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableInt.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mina.common.support.lang.mutable;
+
+/**
+ * A mutable <code>int</code> wrapper.
+ * 
+ * @see Integer
+ * @since 2.1
+ * @version $Id$
+ */
+public class MutableInt extends Number implements Comparable, Mutable {
+
+    /** Serialization lock. */
+    private static final long serialVersionUID = 512176391864L;
+
+    /** The mutable value. */
+    private int value;
+
+    /**
+     * Constructs a new MutableInt with the default value of zero.
+     */
+    public MutableInt() {
+        super();
+    }
+
+    /**
+     * Constructs a new MutableInt with the specified value.
+     * 
+     * @param value
+     *                  a value.
+     */
+    public MutableInt(int value) {
+        super();
+        this.value = value;
+    }
+
+    /**
+     * Constructs a new MutableInt with the specified value.
+     * 
+     * @param value
+     *                  a value.
+     * @throws NullPointerException
+     *                  if the object is null
+     */
+    public MutableInt(Number value) {
+        super();
+        this.value = value.intValue();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value as a Integer instance.
+     * 
+     * @return the value as a Integer
+     */
+    public Object getValue() {
+        return new Integer(this.value);
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value
+     *                  the value to set
+     */
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    /**
+     * Sets the value from any Number instance.
+     * 
+     * @param value
+     *                  the value to set
+     * @throws NullPointerException
+     *                  if the object is null
+     * @throws ClassCastException
+     *                  if the type is not a {@link Number}
+     */
+    public void setValue(Object value) {
+        setValue(((Number) value).intValue());
+    }
+
+    //-----------------------------------------------------------------------
+    // shortValue and bytValue rely on Number implementation
+    /**
+     * Returns the value of this MutableInt as a int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    public int intValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableInt as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    public long longValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableInt as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    public float floatValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableInt as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    public double doubleValue() {
+        return value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
+     * not <code>null</code> and is an <code>MutableInt</code> object that contains the same <code>int</code> value
+     * as this object.
+     * 
+     * @param obj
+     *                  the object to compare with.
+     * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof MutableInt) {
+            return value == ((MutableInt) obj).intValue();
+        }
+        return false;
+    }
+
+    /**
+     * Returns a suitable hashcode for this mutable.
+     * 
+     * @return a suitable hashcode
+     */
+    public int hashCode() {
+        return value;
+    }
+
+    /**
+     * Compares this mutable to another in ascending order.
+     * 
+     * @param obj
+     *                  the mutable to compare to
+     * @return negative if this is less, zero if equal, positive if greater
+     * @throws ClassCastException if the argument is not a MutableInt
+     */
+    public int compareTo(Object obj) {
+        MutableInt other = (MutableInt) obj;
+        int anotherVal = other.value;
+        return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
+    }
+
+    /**
+     * Returns the String value of this mutable.
+     * 
+     * @return the mutable value as a string
+     */
+    public String toString() {
+        return String.valueOf(value);
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableInt.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableLong.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableLong.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableLong.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableLong.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mina.common.support.lang.mutable;
+
+/**
+ * A mutable <code>long</code> wrapper.
+ * 
+ * @see Long
+ * @since 2.1
+ * @version $Id$
+ */
+public class MutableLong extends Number implements Comparable, Mutable {
+
+    /** Serialization lock. */
+    private static final long serialVersionUID = 62986528375L;
+
+    /** The mutable value. */
+    private long value;
+
+    /**
+     * Constructs a new MutableLong with the default value of zero.
+     */
+    public MutableLong() {
+        super();
+    }
+
+    /**
+     * Constructs a new MutableLong with the specified value.
+     * 
+     * @param value
+     *            a value.
+     */
+    public MutableLong(long value) {
+        super();
+        this.value = value;
+    }
+
+    /**
+     * Constructs a new MutableLong with the specified value.
+     * 
+     * @param value
+     *            a value.
+     * @throws NullPointerException
+     *             if the object is null
+     */
+    public MutableLong(Number value) {
+        super();
+        this.value = value.longValue();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value as a Long instance.
+     * 
+     * @return the value as a Long
+     */
+    public Object getValue() {
+        return new Long(this.value);
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value
+     *            the value to set
+     */
+    public void setValue(long value) {
+        this.value = value;
+    }
+
+    /**
+     * Sets the value from any Number instance.
+     * 
+     * @param value
+     *            the value to set
+     * @throws NullPointerException
+     *             if the object is null
+     * @throws ClassCastException
+     *             if the type is not a {@link Number}
+     */
+    public void setValue(Object value) {
+        setValue(((Number) value).longValue());
+    }
+
+    //-----------------------------------------------------------------------
+    // shortValue and bytValue rely on Number implementation
+    /**
+     * Returns the value of this MutableLong as a int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    public int intValue() {
+        return (int) value;
+    }
+
+    /**
+     * Returns the value of this MutableLong as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    public long longValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableLong as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    public float floatValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableLong as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    public double doubleValue() {
+        return value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Compares this object against the specified object. The result is <code>true</code> if and only if the argument
+     * is not <code>null</code> and is a <code>MutableLong</code> object that contains the same <code>long</code>
+     * value as this object.
+     * 
+     * @param obj
+     *            the object to compare with.
+     * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof MutableLong) {
+            return value == ((MutableLong) obj).longValue();
+        }
+        return false;
+    }
+
+    /**
+     * Returns a suitable hashcode for this mutable.
+     * 
+     * @return a suitable hashcode
+     */
+    public int hashCode() {
+        return (int) (value ^ (value >>> 32));
+    }
+
+    /**
+     * Compares this mutable to another in ascending order.
+     * 
+     * @param obj
+     *            the mutable to compare to
+     * @return negative if this is less, zero if equal, positive if greater
+     * @throws ClassCastException if the argument is not a MutableLong
+     */
+    public int compareTo(Object obj) {
+        MutableLong other = (MutableLong) obj;
+        long anotherVal = other.value;
+        return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
+    }
+
+    /**
+     * Returns the String value of this mutable.
+     * 
+     * @return the mutable value as a string
+     */
+    public String toString() {
+        return String.valueOf(value);
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableLong.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableObject.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableObject.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableObject.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableObject.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mina.common.support.lang.mutable;
+
+import java.io.Serializable;
+
+/**
+ * A mutable <code>Object</code> wrapper.
+ * 
+ * @since 2.1
+ * @version $Id$
+ */
+public class MutableObject implements Mutable, Serializable {
+
+    /** Serialization lock. */
+    private static final long serialVersionUID = 86241875189L;
+
+    /** The mutable value. */
+    private Object value;
+
+    /**
+     * Constructs a new MutableObject with the default value of <code>null</code>.
+     */
+    public MutableObject() {
+        super();
+    }
+
+    /**
+     * Constructs a new MutableObject with the specified value.
+     * 
+     * @param value
+     *            a value.
+     */
+    public MutableObject(Object value) {
+        super();
+        this.value = value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value.
+     * 
+     * @return the value
+     */
+    public Object getValue() {
+        return this.value;
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value
+     *            the value to set
+     */
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Compares this object against the specified object. The result is <code>true</code> if and only if the argument
+     * is not <code>null</code> and is a <code>MutableObject</code> object that contains the same <code>Object</code>
+     * value as this object.
+     * 
+     * @param obj
+     *            the object to compare with.
+     * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof MutableObject) {
+            Object other = ((MutableObject) obj).value;
+            return value == other || (value != null && value.equals(other));
+        }
+        return false;
+    }
+
+    /**
+     * Returns the value's hash code or <code>0</code> if the value is <code>null</code>.
+     * 
+     * @return the value's hash code or <code>0</code> if the value is <code>null</code>.
+     */
+    public int hashCode() {
+        return value == null ? 0 : value.hashCode();
+    }
+
+    /**
+     * Returns the String value of this mutable.
+     * 
+     * @return the mutable value as a string
+     */
+    public String toString() {
+        return value == null ? "null" : value.toString();
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableObject.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableShort.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableShort.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableShort.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableShort.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mina.common.support.lang.mutable;
+
+/**
+ * A mutable <code>short</code> wrapper.
+ * 
+ * @see Short
+ * @since 2.1
+ * @version $Id$
+ */
+public class MutableShort extends Number implements Comparable, Mutable {
+
+    /** Serialization lock. */
+    private static final long serialVersionUID = -2135791679L;
+
+    /** The mutable value. */
+    private short value;
+
+    /**
+     * Constructs a new MutableShort with the default value of zero.
+     */
+    public MutableShort() {
+        super();
+    }
+
+    /**
+     * Constructs a new MutableShort with the specified value.
+     * 
+     * @param value
+     *                  a value.
+     */
+    public MutableShort(short value) {
+        super();
+        this.value = value;
+    }
+
+    /**
+     * Constructs a new MutableShort with the specified value.
+     * 
+     * @param value
+     *                  a value.
+     * @throws NullPointerException
+     *                  if the object is null
+     */
+    public MutableShort(Number value) {
+        super();
+        this.value = value.shortValue();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value as a Short instance.
+     * 
+     * @return the value as a Short
+     */
+    public Object getValue() {
+        return new Short(this.value);
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value
+     *                  the value to set
+     */
+    public void setValue(short value) {
+        this.value = value;
+    }
+
+    /**
+     * Sets the value from any Number instance.
+     * 
+     * @param value
+     *                  the value to set
+     * @throws NullPointerException
+     *                  if the object is null
+     * @throws ClassCastException
+     *                  if the type is not a {@link Number}
+     */
+    public void setValue(Object value) {
+        setValue(((Number) value).shortValue());
+    }
+
+    //-----------------------------------------------------------------------
+    // bytValue relies on Number implementation
+    /**
+     * Returns the value of this MutableShort as a short.
+     *
+     * @return the numeric value represented by this object after conversion to type short.
+     */
+    public short shortValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableShort as a int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    public int intValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableShort as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    public long longValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableShort as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    public float floatValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableShort as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    public double doubleValue() {
+        return value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Compares this object against the specified object. The result is <code>true</code> if and only if the argument
+     * is not <code>null</code> and is a <code>MutableShort</code> object that contains the same <code>short</code>
+     * value as this object.
+     * 
+     * @param obj
+     *                  the object to compare with.
+     * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof MutableShort) {
+            return value == ((MutableShort) obj).shortValue();
+        }
+        return false;
+    }
+
+    /**
+     * Returns a suitable hashcode for this mutable.
+     * 
+     * @return a suitable hashcode
+     */
+    public int hashCode() {
+        return value;
+    }
+
+    /**
+     * Compares this mutable to another in ascending order.
+     * 
+     * @param obj
+     *                  the mutable to compare to
+     * @return negative if this is less, zero if equal, positive if greater
+     * @throws ClassCastException if the argument is not a MutableShort
+     */
+    public int compareTo(Object obj) {
+        MutableShort other = (MutableShort) obj;
+        short anotherVal = other.value;
+        return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
+    }
+
+    /**
+     * Returns the String value of this mutable.
+     * 
+     * @return the mutable value as a string
+     */
+    public String toString() {
+        return String.valueOf(value);
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/MutableShort.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/package.html
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/package.html?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/package.html (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/package.html Fri Jan 20 05:47:50 2006
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<!--
+
+Copyright 2002-2005 The Apache Software Foundation.
+
+ 
+
+Licensed under the Apache License, Version 2.0 (the "License");
+
+you may not use this file except in compliance with the License.
+
+You may obtain a copy of the License at
+
+
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+Unless required by applicable law or agreed to in writing, software
+
+distributed under the License is distributed on an "AS IS" BASIS,
+
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+See the License for the specific language governing permissions and
+
+limitations under the License.
+
+-->
+  <title></title>
+</head>
+<body>
+Provides typed mutable wrappers to primitive values and Object.
+@since 2.1
+</body>
+</html>

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/mutable/package.html
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/overview.html
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/overview.html?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/overview.html (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/overview.html Fri Jan 20 05:47:50 2006
@@ -0,0 +1,22 @@
+<!--
+Copyright 2002-2005 The Apache Software Foundation.
+ 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<html>
+<body>
+<p>
+This document is the API specification for the Apache Jakarta Commons Lang Library, version 2.1.
+</p>
+</body>
+</html>

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/overview.html
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/package.html
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/package.html?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/package.html (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/package.html Fri Jan 20 05:47:50 2006
@@ -0,0 +1,22 @@
+<!--
+Copyright 2002-2005 The Apache Software Foundation.
+ 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<html>
+<body>
+Provides highly reusable static utility methods, chiefly concerned 
+with adding value to {@link java.lang} and other standard core classes.
+@since 1.0
+</body>
+</html>

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/package.html
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateFormatUtils.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateFormatUtils.java?rev=370807&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateFormatUtils.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateFormatUtils.java Fri Jan 20 05:47:50 2006
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.mina.common.support.lang.time;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * <p>Date and time formatting utilities and constants.</p>
+ *
+ * <p>Formatting is performed using the
+ * {@link org.apache.mina.common.support.lang.time.FastDateFormat} class.</p>
+ *
+ * @author Apache Ant - DateUtils
+ * @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
+ * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
+ * @author Stephen Colebourne
+ * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
+ * @since 2.0
+ * @version $Id$
+ */
+public class DateFormatUtils {
+
+    /**
+     * ISO8601 formatter for date-time without time zone.
+     * The format used is <tt>yyyy-MM-dd'T'HH:mm:ss</tt>.
+     */
+    public static final FastDateFormat ISO_DATETIME_FORMAT
+            = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss");
+
+    /**
+     * ISO8601 formatter for date-time with time zone.
+     * The format used is <tt>yyyy-MM-dd'T'HH:mm:ssZZ</tt>.
+     */
+    public static final FastDateFormat ISO_DATETIME_TIME_ZONE_FORMAT
+            = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssZZ");
+
+    /**
+     * ISO8601 formatter for date without time zone.
+     * The format used is <tt>yyyy-MM-dd</tt>.
+     */
+    public static final FastDateFormat ISO_DATE_FORMAT
+            = FastDateFormat.getInstance("yyyy-MM-dd");
+
+    /**
+     * ISO8601-like formatter for date with time zone.
+     * The format used is <tt>yyyy-MM-ddZZ</tt>.
+     * This pattern does not comply with the formal ISO8601 specification
+     * as the standard does not allow a time zone  without a time.
+     */
+    public static final FastDateFormat ISO_DATE_TIME_ZONE_FORMAT
+            = FastDateFormat.getInstance("yyyy-MM-ddZZ");
+
+    /**
+     * ISO8601 formatter for time without time zone.
+     * The format used is <tt>'T'HH:mm:ss</tt>.
+     */
+    public static final FastDateFormat ISO_TIME_FORMAT
+            = FastDateFormat.getInstance("'T'HH:mm:ss");
+
+    /**
+     * ISO8601 formatter for time with time zone.
+     * The format used is <tt>'T'HH:mm:ssZZ</tt>.
+     */
+    public static final FastDateFormat ISO_TIME_TIME_ZONE_FORMAT
+            = FastDateFormat.getInstance("'T'HH:mm:ssZZ");
+
+    /**
+     * ISO8601-like formatter for time without time zone.
+     * The format used is <tt>HH:mm:ss</tt>.
+     * This pattern does not comply with the formal ISO8601 specification
+     * as the standard requires the 'T' prefix for times.
+     */
+    public static final FastDateFormat ISO_TIME_NO_T_FORMAT
+            = FastDateFormat.getInstance("HH:mm:ss");
+
+    /**
+     * ISO8601-like formatter for time with time zone.
+     * The format used is <tt>HH:mm:ssZZ</tt>.
+     * This pattern does not comply with the formal ISO8601 specification
+     * as the standard requires the 'T' prefix for times.
+     */
+    public static final FastDateFormat ISO_TIME_NO_T_TIME_ZONE_FORMAT
+            = FastDateFormat.getInstance("HH:mm:ssZZ");
+
+    /**
+     * SMTP (and probably other) date headers.
+     * The format used is <tt>EEE, dd MMM yyyy HH:mm:ss Z</tt> in US locale.
+     */
+    public static final FastDateFormat SMTP_DATETIME_FORMAT
+            = FastDateFormat.getInstance("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
+
+    //-----------------------------------------------------------------------
+    /**
+     * <p>DateFormatUtils instances should NOT be constructed in standard programming.</p>
+     *
+     * <p>This constructor is public to permit tools that require a JavaBean instance
+     * to operate.</p>
+     */
+    public DateFormatUtils() {
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern using the UTC time zone.</p>
+     * 
+     * @param millis  the date to format expressed in milliseconds
+     * @param pattern  the pattern to use to format the date
+     * @return the formatted date
+     */
+    public static String formatUTC(long millis, String pattern) {
+        return format(new Date(millis), pattern, DateUtils.UTC_TIME_ZONE, null);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern using the UTC time zone.</p>
+     * 
+     * @param date  the date to format
+     * @param pattern  the pattern to use to format the date
+     * @return the formatted date
+     */
+    public static String formatUTC(Date date, String pattern) {
+        return format(date, pattern, DateUtils.UTC_TIME_ZONE, null);
+    }
+    
+    /**
+     * <p>Format a date/time into a specific pattern using the UTC time zone.</p>
+     * 
+     * @param millis  the date to format expressed in milliseconds
+     * @param pattern  the pattern to use to format the date
+     * @param locale  the locale to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String formatUTC(long millis, String pattern, Locale locale) {
+        return format(new Date(millis), pattern, DateUtils.UTC_TIME_ZONE, locale);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern using the UTC time zone.</p>
+     * 
+     * @param date  the date to format
+     * @param pattern  the pattern to use to format the date
+     * @param locale  the locale to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String formatUTC(Date date, String pattern, Locale locale) {
+        return format(date, pattern, DateUtils.UTC_TIME_ZONE, locale);
+    }
+    
+    /**
+     * <p>Format a date/time into a specific pattern.</p>
+     * 
+     * @param millis  the date to format expressed in milliseconds
+     * @param pattern  the pattern to use to format the date
+     * @return the formatted date
+     */
+    public static String format(long millis, String pattern) {
+        return format(new Date(millis), pattern, null, null);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern.</p>
+     * 
+     * @param date  the date to format
+     * @param pattern  the pattern to use to format the date
+     * @return the formatted date
+     */
+    public static String format(Date date, String pattern) {
+        return format(date, pattern, null, null);
+    }
+    
+    /**
+     * <p>Format a date/time into a specific pattern in a time zone.</p>
+     * 
+     * @param millis  the time expressed in milliseconds
+     * @param pattern  the pattern to use to format the date
+     * @param timeZone  the time zone  to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String format(long millis, String pattern, TimeZone timeZone) {
+        return format(new Date(millis), pattern, timeZone, null);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern in a time zone.</p>
+     * 
+     * @param date  the date to format
+     * @param pattern  the pattern to use to format the date
+     * @param timeZone  the time zone  to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String format(Date date, String pattern, TimeZone timeZone) {
+        return format(date, pattern, timeZone, null);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern in a locale.</p>
+     * 
+     * @param millis  the date to format expressed in milliseconds
+     * @param pattern  the pattern to use to format the date
+     * @param locale  the locale to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String format(long millis, String pattern, Locale locale) {
+        return format(new Date(millis), pattern, null, locale);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern in a locale.</p>
+     * 
+     * @param date  the date to format
+     * @param pattern  the pattern to use to format the date
+     * @param locale  the locale to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String format(Date date, String pattern, Locale locale) {
+        return format(date, pattern, null, locale);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern in a time zone  and locale.</p>
+     * 
+     * @param millis  the date to format expressed in milliseconds
+     * @param pattern  the pattern to use to format the date
+     * @param timeZone  the time zone  to use, may be <code>null</code>
+     * @param locale  the locale to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String format(long millis, String pattern, TimeZone timeZone, Locale locale) {
+        return format(new Date(millis), pattern, timeZone, locale);
+    }
+
+    /**
+     * <p>Format a date/time into a specific pattern in a time zone  and locale.</p>
+     * 
+     * @param date  the date to format
+     * @param pattern  the pattern to use to format the date
+     * @param timeZone  the time zone  to use, may be <code>null</code>
+     * @param locale  the locale to use, may be <code>null</code>
+     * @return the formatted date
+     */
+    public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) {
+        FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale);
+        return df.format(date);
+    }
+
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateFormatUtils.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision



Mime
View raw message