1052 * The method attempts to parse text starting at the index given by
1053 * <code>pos</code>.
1054 * If parsing succeeds, then the index of <code>pos</code> is updated
1055 * to the index after the last character used (parsing does not necessarily
1056 * use all characters up to the end of the string), and the parsed
1057 * object array is returned. The updated <code>pos</code> can be used to
1058 * indicate the starting point for the next call to this method.
1059 * If an error occurs, then the index of <code>pos</code> is not
1060 * changed, the error index of <code>pos</code> is set to the index of
1061 * the character where the error occurred, and null is returned.
1062 * <p>
1063 * See the {@link #parse(String, ParsePosition)} method for more information
1064 * on message parsing.
1065 *
1066 * @param source A <code>String</code>, part of which should be parsed.
1067 * @param pos A <code>ParsePosition</code> object with index and error
1068 * index information as described above.
1069 * @return An <code>Object</code> array parsed from the string. In case of
1070 * error, returns null.
1071 * @exception NullPointerException if <code>pos</code> is null.
1072 */
1073 public Object parseObject(String source, ParsePosition pos) {
1074 return parse(source, pos);
1075 }
1076
1077 /**
1078 * Creates and returns a copy of this object.
1079 *
1080 * @return a clone of this instance.
1081 */
1082 public Object clone() {
1083 MessageFormat other = (MessageFormat) super.clone();
1084
1085 // clone arrays. Can't do with utility because of bug in Cloneable
1086 other.formats = formats.clone(); // shallow clone
1087 for (int i = 0; i < formats.length; ++i) {
1088 if (formats[i] != null)
1089 other.formats[i] = (Format)formats[i].clone();
1090 }
1091 // for primitives or immutables, shallow clone is enough
|
1052 * The method attempts to parse text starting at the index given by
1053 * <code>pos</code>.
1054 * If parsing succeeds, then the index of <code>pos</code> is updated
1055 * to the index after the last character used (parsing does not necessarily
1056 * use all characters up to the end of the string), and the parsed
1057 * object array is returned. The updated <code>pos</code> can be used to
1058 * indicate the starting point for the next call to this method.
1059 * If an error occurs, then the index of <code>pos</code> is not
1060 * changed, the error index of <code>pos</code> is set to the index of
1061 * the character where the error occurred, and null is returned.
1062 * <p>
1063 * See the {@link #parse(String, ParsePosition)} method for more information
1064 * on message parsing.
1065 *
1066 * @param source A <code>String</code>, part of which should be parsed.
1067 * @param pos A <code>ParsePosition</code> object with index and error
1068 * index information as described above.
1069 * @return An <code>Object</code> array parsed from the string. In case of
1070 * error, returns null.
1071 * @exception NullPointerException if <code>pos</code> is null.
1072 * @throws NullPointerException if {@code source} is null.
1073 */
1074 public Object parseObject(String source, ParsePosition pos) {
1075 return parse(source, pos);
1076 }
1077
1078 /**
1079 * Creates and returns a copy of this object.
1080 *
1081 * @return a clone of this instance.
1082 */
1083 public Object clone() {
1084 MessageFormat other = (MessageFormat) super.clone();
1085
1086 // clone arrays. Can't do with utility because of bug in Cloneable
1087 other.formats = formats.clone(); // shallow clone
1088 for (int i = 0; i < formats.length; ++i) {
1089 if (formats[i] != null)
1090 other.formats[i] = (Format)formats[i].clone();
1091 }
1092 // for primitives or immutables, shallow clone is enough
|