Examples of ConversionException


Examples of nhandler.conversion.ConversionException

    } else if (fi.isFloatField()) {
      fld.setFloat(obj, ei.getFloatField(fi));
    } else if (fi.isDoubleField()) {
      fld.setDouble(obj, ei.getDoubleField(fi));
    } else {
      throw new ConversionException("Unknown premitive type " + fi.getType());
    }
  }
View Full Code Here

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

Examples of org.apache.commons.beanutils.ConversionException

      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

Examples of org.apache.commons.beanutils.ConversionException

    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

Examples of org.apache.commons.beanutils.ConversionException

        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

Examples of org.apache.commons.beanutils.ConversionException

   {
      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

Examples of org.apache.commons.beanutils.ConversionException

   {
      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

Examples of org.apache.commons.beanutils.ConversionException

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

Examples of org.apache.commons.beanutils.ConversionException

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

Examples of org.apache.commons.beanutils.ConversionException

        if (cal != null) return cal;

        if (useDefault) {
            return defaultValue;
        } else {
            throw new ConversionException("Failed to parse date: " + value);
        }
    }
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.