Package jodd.typeconverter

Examples of jodd.typeconverter.TypeConversionException


    }

    try {
      return UserLevel.valueOf(stringValue);
    } catch (IllegalArgumentException iaex) {
      throw new TypeConversionException(value, iaex);
    }
  }
View Full Code Here


      return null;
    }
    if (value instanceof FileUpload) {
      return (FileUpload) value;
    }
    throw new TypeConversionException(value);
  }
View Full Code Here

      long milliseconds = Long.parseLong(stringValue);
      Calendar calendar = Calendar.getInstance();
      calendar.setTimeInMillis(milliseconds);
      return calendar;
    } catch (NumberFormatException nfex) {
      throw new TypeConversionException(value, nfex);
    }
  }
View Full Code Here

    if (value instanceof Blob) {
      Blob blob = (Blob) value;
      try {
        long length = blob.length();
        if (length > Integer.MAX_VALUE) {
          throw new TypeConversionException("Blob is too big.");
        }
        return blob.getBytes(1, (int) length);
      } catch (SQLException sex) {
        throw new TypeConversionException(value, sex);
      }
    }

    if (value instanceof File) {
      try {
        return FileUtil.readBytes((File) value);
      } catch (IOException ioex) {
        throw new TypeConversionException(value, ioex);
      }
    }

    if (value instanceof List) {
      List list = (List) value;
View Full Code Here

      if (StringUtil.startsWithChar(stringValue, '+')) {
        stringValue = stringValue.substring(1);
      }
      return Byte.valueOf(stringValue);
    } catch (NumberFormatException nfex) {
      throw new TypeConversionException(value, nfex);
    }
  }
View Full Code Here

    try {
      String s = value.toString();
      if (s.length() != 1) {
        s = s.trim();
        if (!StringUtil.containsOnlyDigitsAndSigns(s)) {
          throw new TypeConversionException(value);
        }

        try {
          char c = (char) Integer.parseInt(s);
          return Character.valueOf(c);
        } catch (NumberFormatException nfex) {
          throw new TypeConversionException(value, nfex);
        }
      }
      return Character.valueOf(s.charAt(0));
    } catch (IndexOutOfBoundsException ioobex) {
      throw new TypeConversionException(value, ioobex);
    }
  }
View Full Code Here

      if (StringUtil.startsWithChar(stringValue, '+')) {
        stringValue = stringValue.substring(1);
      }
      return Float.valueOf(stringValue);
    } catch (NumberFormatException nfex) {
      throw new TypeConversionException(value, nfex);
    }
  }
View Full Code Here

    if (value instanceof Clob) {
      Clob clob = (Clob) value;
      try {
        long length = clob.length();
        if (length > Integer.MAX_VALUE) {
          throw new TypeConversionException("Clob is too big.");
        }
        return clob.getSubString(1, (int) length);
      } catch (SQLException sex) {
        throw new TypeConversionException(value, sex);
      }
    }
    return value.toString();
  }
View Full Code Here

      return (BigDecimal) value;
    }
    try {
      return new BigDecimal(value.toString().trim());
    } catch (NumberFormatException nfex) {
      throw new TypeConversionException(value, nfex);
    }
  }
View Full Code Here

        stringValue.equals(OFF) ||
        stringValue.equals(ZERO)) {
      return Boolean.FALSE;
    }

    throw new TypeConversionException(value);
  }
View Full Code Here

TOP

Related Classes of jodd.typeconverter.TypeConversionException

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.