Package java.text

Examples of java.text.Format.parseObject()


      return o;
    }

    try
    {
      return f.parseObject(String.valueOf(o));
    }
    catch (ParseException e)
    {
      return null;
    }
View Full Code Here


      return o;
    }

    try
    {
      return f.parseObject(String.valueOf(o));
    }
    catch (ParseException e)
    {
      return null;
    }
View Full Code Here

    Object value = preprocessText(object, textValue, context);
    if (value == textValue) {
      Format f = getFormat(object);
      if (f != null) {
        try {
          value = f.parseObject(textValue);
        } catch (ParseException e) {
          f = getSecondaryFormat(object); // allow money to parse as number too
          boolean secondOK = false;
          if (f != null) {
            try {
View Full Code Here

        } catch (ParseException e) {
          f = getSecondaryFormat(object); // allow money to parse as number too
          boolean secondOK = false;
          if (f != null) {
            try {
              value = f.parseObject(textValue);
              secondOK = true;
            } catch (ParseException e1) {
            }
          }
          if (!secondOK)
View Full Code Here

    Object value = preprocessText(object, textValue, context);
    if (value == textValue) {
      Format f = getFormat(object);
      if (f != null) {
        try {
          value = f.parseObject(textValue);
        } catch (ParseException e) {
          throw new FieldParseException(e);
        }
      } else {
        value = FieldConverter.convert(textValue, hasExternalType() ? externalType : internalType, context); // converts
View Full Code Here

        QueryPlan plan = pstmt.optimizeQuery();
        Scan scan = plan.getContext().getScan();
        Filter filter = scan.getFilter();

        Format format = DateUtil.getDateParser(DateUtil.DEFAULT_DATE_FORMAT);
        Object date = format.parseObject(dateStr);

        assertEquals(
            singleKVFilter(constantComparison(
                CompareOp.GREATER_OR_EQUAL,
                A_DATE,
View Full Code Here

    {
        Format format = getFormat(messages.getLocale());
       
        try
        {
            return format.parseObject(text);
        }
        catch (ParseException ex)
        {
            throw new ValidatorException(buildMessage(messages, field, getMessageKey()),
                    getConstraint());
View Full Code Here

    /** Tests, whether e zero as suffix matters in milliseconds.
     */
    public void testZeroSuffix() throws Exception {
        Format format = new XsDateTimeFormat();
        Calendar c1 = (Calendar) format.parseObject("2006-05-03T15:29:17.15Z");
        Calendar c2 = (Calendar) format.parseObject("2006-05-03T15:29:17.150Z");
        assertEquals(c1, c2);

        format = new XsTimeFormat();
        c1 = (Calendar) format.parseObject("15:29:17.15Z");
View Full Code Here

    /** Tests, whether e zero as suffix matters in milliseconds.
     */
    public void testZeroSuffix() throws Exception {
        Format format = new XsDateTimeFormat();
        Calendar c1 = (Calendar) format.parseObject("2006-05-03T15:29:17.15Z");
        Calendar c2 = (Calendar) format.parseObject("2006-05-03T15:29:17.150Z");
        assertEquals(c1, c2);

        format = new XsTimeFormat();
        c1 = (Calendar) format.parseObject("15:29:17.15Z");
        c2 = (Calendar) format.parseObject("15:29:17.150Z");
View Full Code Here

        Calendar c1 = (Calendar) format.parseObject("2006-05-03T15:29:17.15Z");
        Calendar c2 = (Calendar) format.parseObject("2006-05-03T15:29:17.150Z");
        assertEquals(c1, c2);

        format = new XsTimeFormat();
        c1 = (Calendar) format.parseObject("15:29:17.15Z");
        c2 = (Calendar) format.parseObject("15:29:17.150Z");
        assertEquals(c1, c2);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.