< prev index next >

src/java.base/share/classes/java/text/Format.java

Print this page




 112  * object which identifies what information is contained in the field and its
 113  * position in the formatted result. These constants should be named
 114  * <code><em>item</em>_FIELD</code> where <code><em>item</em></code> identifies
 115  * the field. For examples of these constants, see <code>ERA_FIELD</code> and its
 116  * friends in {@link DateFormat}.
 117  *
 118  * <h4><a id="synchronization">Synchronization</a></h4>
 119  *
 120  * <p>
 121  * Formats are generally not synchronized.
 122  * It is recommended to create separate format instances for each thread.
 123  * If multiple threads access a format concurrently, it must be synchronized
 124  * externally.
 125  *
 126  * @see          java.text.ParsePosition
 127  * @see          java.text.FieldPosition
 128  * @see          java.text.NumberFormat
 129  * @see          java.text.DateFormat
 130  * @see          java.text.MessageFormat
 131  * @author       Mark Davis

 132  */
 133 public abstract class Format implements Serializable, Cloneable {
 134 
 135     private static final long serialVersionUID = -299282585814624189L;
 136 
 137     /**
 138      * Sole constructor.  (For invocation by subclass constructors, typically
 139      * implicit.)
 140      */
 141     protected Format() {
 142     }
 143 
 144     /**
 145      * Formats an object to produce a string. This is equivalent to
 146      * <blockquote>
 147      * {@link #format(Object, StringBuffer, FieldPosition) format}<code>(obj,
 148      *         new StringBuffer(), new FieldPosition(0)).toString();</code>
 149      * </blockquote>
 150      *
 151      * @param obj    The object to format




 112  * object which identifies what information is contained in the field and its
 113  * position in the formatted result. These constants should be named
 114  * <code><em>item</em>_FIELD</code> where <code><em>item</em></code> identifies
 115  * the field. For examples of these constants, see <code>ERA_FIELD</code> and its
 116  * friends in {@link DateFormat}.
 117  *
 118  * <h4><a id="synchronization">Synchronization</a></h4>
 119  *
 120  * <p>
 121  * Formats are generally not synchronized.
 122  * It is recommended to create separate format instances for each thread.
 123  * If multiple threads access a format concurrently, it must be synchronized
 124  * externally.
 125  *
 126  * @see          java.text.ParsePosition
 127  * @see          java.text.FieldPosition
 128  * @see          java.text.NumberFormat
 129  * @see          java.text.DateFormat
 130  * @see          java.text.MessageFormat
 131  * @author       Mark Davis
 132  * @since 1.1
 133  */
 134 public abstract class Format implements Serializable, Cloneable {
 135 
 136     private static final long serialVersionUID = -299282585814624189L;
 137 
 138     /**
 139      * Sole constructor.  (For invocation by subclass constructors, typically
 140      * implicit.)
 141      */
 142     protected Format() {
 143     }
 144 
 145     /**
 146      * Formats an object to produce a string. This is equivalent to
 147      * <blockquote>
 148      * {@link #format(Object, StringBuffer, FieldPosition) format}<code>(obj,
 149      *         new StringBuffer(), new FieldPosition(0)).toString();</code>
 150      * </blockquote>
 151      *
 152      * @param obj    The object to format


< prev index next >