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. package java.text;
  8. /**
  9. * DontCareFieldPosition defines no-op FieldDelegate. Its
  10. * singleton is used for the format methods that don't take a
  11. * FieldPosition.
  12. */
  13. class DontCareFieldPosition extends FieldPosition {
  14. // The singleton of DontCareFieldPosition.
  15. static final FieldPosition INSTANCE = new DontCareFieldPosition();
  16. private final Format.FieldDelegate noDelegate = new Format.FieldDelegate() {
  17. public void formatted(Format.Field attr, Object value, int start,
  18. int end, StringBuffer buffer) {
  19. }
  20. public void formatted(int fieldID, Format.Field attr, Object value,
  21. int start, int end, StringBuffer buffer) {
  22. }
  23. };
  24. private DontCareFieldPosition() {
  25. super(0);
  26. }
  27. Format.FieldDelegate getFieldDelegate() {
  28. return noDelegate;
  29. }
  30. }