Package org.apache.wicket.util.convert

Examples of org.apache.wicket.util.convert.ConversionException


      {
        setMethod.setAccessible(true);
        Object converted = converter.convert(value, getMethod.getReturnType());
        if (converted == null && value != null)
        {
          throw new ConversionException("Can't convert value: " + value + " to class: " +
            getMethod.getReturnType() + " for setting it on " + object);
        }
        try
        {
          setMethod.invoke(object, index, converted);
View Full Code Here


        converted = converter.convert(value, type);
        if (converted == null)
        {
          if (value != null)
          {
            throw new ConversionException("Method [" + getMethod +
              "]. Can't convert value: " + value + " to class: " +
              getMethod.getReturnType() + " for setting it on " + object);
          }
          else if (getMethod.getReturnType().isPrimitive())
          {
            throw new ConversionException("Method [" + getMethod +
              "]. Can't convert null value to a primitive class: " +
              getMethod.getReturnType() + " for setting it on " + object);
          }
        }
      }
View Full Code Here

            try {
                DateTimeFormatter dateFmt = getFormat().withZone(DateTimeZone.UTC);
                date = dateFmt.parseMillis(value);
            }
            catch (IllegalArgumentException e) {
                throw new ConversionException("Cannot convert '" + value + "' to a Date.")
                    .setSourceValue(value)
                    .setTargetType(type)
                    .setConverter(this)
                    .setLocale(locale);               
            }
View Full Code Here

            dateFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
            try {
                date = dateFmt.parse(value);
            }
            catch (ParseException e) {
                throw new ConversionException("Cannot convert '" + value + "' to a Date.").setSourceValue(value)
                    .setTargetType(type).setConverter(this).setLocale(locale);
            }
           
            if (Timestamp.class == type) {
                return new Timestamp(date.getTime());
View Full Code Here

      {
        setMethod.setAccessible(true);
        Object converted = converter.convert(value, getMethod.getReturnType());
        if (converted == null && value != null)
        {
          throw new ConversionException("Can't convert value: " + value + " to class: " +
            getMethod.getReturnType() + " for setting it on " + object);
        }
        try
        {
          setMethod.invoke(object, index, converted);
View Full Code Here

        converted = converter.convert(value, type);
        if (converted == null)
        {
          if (value != null)
          {
            throw new ConversionException("Method [" + getMethod +
              "]. Can't convert value: " + value + " to class: " +
              getMethod.getReturnType() + " for setting it on " + object);
          }
          else if (getMethod.getReturnType().isPrimitive())
          {
            throw new ConversionException("Method [" + getMethod +
              "]. Can't convert null value to a primitive class: " +
              getMethod.getReturnType() + " for setting it on " + object);
          }
        }
      }
View Full Code Here

          return theType.cast(value);
        }
      }
      catch (Exception e)
      {
        throw new ConversionException(e.getMessage(), e).setSourceValue(value);
      }

      throw new ConversionException("Could not convert value: " + value + " to type: " +
        theType.getName() + ". Could not find compatible converter.").setSourceValue(value);
    }
View Full Code Here

      {
        return Objects.convertValue(value, String.class);
      }
      catch (RuntimeException e)
      {
        throw new ConversionException("Could not convert object of type: " +
          value.getClass() + " to string. Possible its #toString() returned null. " +
          "Either install a custom converter (see IConverterLocator) or " +
          "override #toString() to return a non-null value.", e).setSourceValue(value)
          .setConverter(this);
      }
View Full Code Here

        // parse date retaining the time of the submission
        dateTime = format.parseDateTime(value);
      }
      catch (RuntimeException e)
      {
        throw new ConversionException(e);
      }
      // apply the server time zone to the parsed value
      if (zone != null)
      {
        dateTime = dateTime.withZoneRetainFields(DateTimeZone.forTimeZone(zone));
      }

      return dateTime.toDate();
    }
    else
    {
      try
      {
        DateTime date = format.parseDateTime(value);
        return date.toDate();
      }
      catch (RuntimeException e)
      {
        throw new ConversionException(e);
      }
    }
  }
View Full Code Here

          return theType.cast(value);
        }
      }
      catch (Exception e)
      {
        throw new ConversionException(e.getMessage(), e).setSourceValue(value);
      }

      throw new ConversionException("Could not convert value: " + value + " to type: " +
        theType.getName() + ". Could not find compatible converter.").setSourceValue(value);
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.convert.ConversionException

Copyright © 2018 www.massapicom. 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.