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

Print this page




 353          * Creates a Field with the specified name.
 354          *
 355          * @param name Name of the attribute
 356          */
 357         protected Field(String name) {
 358             super(name);
 359         }
 360     }
 361 
 362 
 363     /**
 364      * FieldDelegate is notified by the various <code>Format</code>
 365      * implementations as they are formatting the Objects. This allows for
 366      * storage of the individual sections of the formatted String for
 367      * later use, such as in a <code>FieldPosition</code> or for an
 368      * <code>AttributedCharacterIterator</code>.
 369      * <p>
 370      * Delegates should NOT assume that the <code>Format</code> will notify
 371      * the delegate of fields in any particular order.
 372      *
 373      * @see FieldPosition.Delegate
 374      * @see CharacterIteratorFieldDelegate
 375      */
 376     interface FieldDelegate {
 377         /**
 378          * Notified when a particular region of the String is formatted. This
 379          * method will be invoked if there is no corresponding integer field id
 380          * matching <code>attr</code>.
 381          *
 382          * @param attr Identifies the field matched
 383          * @param value Value associated with the field
 384          * @param start Beginning location of the field, will be >= 0
 385          * @param end End of the field, will be >= start and <= buffer.length()
 386          * @param buffer Contains current formatted value, receiver should
 387          *        NOT modify it.
 388          */
 389         public void formatted(Format.Field attr, Object value, int start,
 390                               int end, StringBuffer buffer);
 391 
 392         /**
 393          * Notified when a particular region of the String is formatted.


 353          * Creates a Field with the specified name.
 354          *
 355          * @param name Name of the attribute
 356          */
 357         protected Field(String name) {
 358             super(name);
 359         }
 360     }
 361 
 362 
 363     /**
 364      * FieldDelegate is notified by the various <code>Format</code>
 365      * implementations as they are formatting the Objects. This allows for
 366      * storage of the individual sections of the formatted String for
 367      * later use, such as in a <code>FieldPosition</code> or for an
 368      * <code>AttributedCharacterIterator</code>.
 369      * <p>
 370      * Delegates should NOT assume that the <code>Format</code> will notify
 371      * the delegate of fields in any particular order.
 372      *
 373      * @see FieldPosition#getFieldDelegate
 374      * @see CharacterIteratorFieldDelegate
 375      */
 376     interface FieldDelegate {
 377         /**
 378          * Notified when a particular region of the String is formatted. This
 379          * method will be invoked if there is no corresponding integer field id
 380          * matching <code>attr</code>.
 381          *
 382          * @param attr Identifies the field matched
 383          * @param value Value associated with the field
 384          * @param start Beginning location of the field, will be >= 0
 385          * @param end End of the field, will be >= start and <= buffer.length()
 386          * @param buffer Contains current formatted value, receiver should
 387          *        NOT modify it.
 388          */
 389         public void formatted(Format.Field attr, Object value, int start,
 390                               int end, StringBuffer buffer);
 391 
 392         /**
 393          * Notified when a particular region of the String is formatted.