Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.ConversionException


      return null;
    } else if (type == Date.class) {
      return convertToDate(value);
    } else if (type == String.class) { return convertToString(value); }

    throw new ConversionException("Could not convert " + value.getClass().getName() + " to "
        + type.getName());
  }
View Full Code Here


      return null;
    } else if (type == Date.class) {
      return convertToDate(type, value);
    } else if (type == String.class) { return convertToString(type, value); }

    throw new ConversionException("Could not convert " + value.getClass().getName() + " to "
        + type.getName());
  }
View Full Code Here

    final Number parsed = (Number) super.parse(value, pattern);
    double doubleValue = parsed.doubleValue();
    double posDouble = (doubleValue >= 0) ? doubleValue : (doubleValue * -1);
    if ((posDouble > 0 && posDouble < Float.MIN_VALUE) || posDouble > Float.MAX_VALUE)
    {
      throw new ConversionException("Supplied number is not of type Float: "+parsed);
    }
    return new Float(parsed.floatValue()); // unlike superclass it returns Float type
  }
View Full Code Here

        if (value == null) {
            if (this.useDefault) {
                return (this.defaultValue);
            }
            throw new ConversionException("No value specified");
        }

        if (value instanceof Date) {
            return (value);
        } else if (value instanceof java.lang.String) {
            String valueStr = (String) value;
            // w3c DateParser defaults to 1970 for an empty string
            if (valueStr.length() == 0) {
                throw new ConversionException(
                        "Cannot convert an empty string to " + Date.class);
            }
            try {
                return DateParser.parse(valueStr);
            } catch (InvalidDateException ide) {
                throw new ConversionException(ide);
            }
        }

        if (this.useDefault) {
            return (this.defaultValue);
        }
        throw new ConversionException("Cannot convert.");

    }
View Full Code Here

   {
      if (value instanceof String)
      {
         return Enum.valueOf(Case.class, ((String) value).toUpperCase());
      }
      throw new ConversionException("Could not convert value: [" + value + "] to Case type.");
   }
View Full Code Here

   {
      if (value instanceof String)
      {
         return Enum.valueOf(TrailingSlash.class, ((String) value).toUpperCase());
      }
      throw new ConversionException("Could not convert value: [" + value + "] to TrailingSlash type.");
   }
View Full Code Here

         {
            item = "TEMPORARY";
         }
         return Enum.valueOf(Redirect.class, item.toUpperCase());
      }
      throw new ConversionException("Could not convert value: [" + value + "] to Redirect type.");
   }
View Full Code Here

      {
         result = PhaseId.RENDER_RESPONSE;
      }
      else
      {
         throw new ConversionException("Could not convert value: [" + value + "] to FacesPhaseId type.");
      }
      return result;
   }
View Full Code Here

        if (cal != null) return cal;

        if (useDefault) {
            return defaultValue;
        } else {
            throw new ConversionException("Failed to parse date: " + value);
        }
    }
View Full Code Here

            return sObjectRefValue;
        } catch (ClassCastException e) {
            if (useDefault) {
                return defaultValue;
            } else {
                throw new ConversionException(e);
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.commons.beanutils.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.