Java Code Examples for java.text.Format#Field
The following examples show how to use
java.text.Format#Field .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Support_Format.java From j2objc with Apache License 2.0 | 6 votes |
protected void t_FormatWithField(int count, Format format, Object object, String text, Format.Field field, int begin, int end) { StringBuffer buffer = new StringBuffer(); FieldPosition pos = new FieldPosition(field); format.format(object, buffer, pos); // System.out.println(buffer); // System.out.println(pos); if (text == null) { assertEquals("Test " + count + ": incorrect formatted text", this.text, buffer.toString()); } else { assertEquals(text, buffer.toString()); } if (begin != pos.getBeginIndex() || end != pos.getEndIndex()) { assertEquals(field + " " + begin + ".." + end, pos.getFieldAttribute() + " " + pos.getBeginIndex() + ".." + pos.getEndIndex()); } }
Example 2
Source File: AngleFormat.java From sis with Apache License 2.0 | 5 votes |
/** * Returns the {@code *_FIELD} constant for the given field position, or -1 if none. */ private static int getField(final FieldPosition position) { if (position != null) { final Format.Field field = position.getFieldAttribute(); if (field instanceof Field) { return ((Field) field).field; } return position.getField(); } return -1; }
Example 3
Source File: RangeFormat.java From sis with Apache License 2.0 | 5 votes |
/** * Returns the {@code *_FIELD} constant for the given field position, or -1 if none. */ private static int getField(final FieldPosition position) { if (position != null) { final Format.Field field = position.getFieldAttribute(); if (field instanceof Field) { return ((Field) field).field; } return position.getField(); } return -1; }