KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > text > DontCareFieldPosition


1 /*
2  * @(#)DontCareFieldPosition.java 1.3 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.text;
9
10 /**
11  * DontCareFieldPosition defines no-op FieldDelegate. Its
12  * singleton is used for the format methods that don't take a
13  * FieldPosition.
14  */

15 class DontCareFieldPosition extends FieldPosition JavaDoc {
16     // The singleton of DontCareFieldPosition.
17
static final FieldPosition JavaDoc INSTANCE = new DontCareFieldPosition JavaDoc();
18
19     private final Format.FieldDelegate JavaDoc noDelegate = new Format.FieldDelegate JavaDoc() {
20     public void formatted(Format.Field JavaDoc attr, Object JavaDoc value, int start,
21                   int end, StringBuffer JavaDoc buffer) {
22     }
23     public void formatted(int fieldID, Format.Field JavaDoc attr, Object JavaDoc value,
24                   int start, int end, StringBuffer JavaDoc buffer) {
25     }
26     };
27
28     private DontCareFieldPosition() {
29     super(0);
30     }
31
32     Format.FieldDelegate JavaDoc getFieldDelegate() {
33     return noDelegate;
34     }
35 }
36
Popular Tags