Package wicket.util.convert

Examples of wicket.util.convert.ConversionException


            if (urlString.equals("")) {
              return null;
            } else {
              url = Transformer.url(urlString);
              if (url == null) {
                throw new ConversionException(
                    "Not a valid URL: " + source);
              }
            }
          } else {
            throw new ConversionException("Not a valid URL: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from URL to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof URL) {
            URL convertedUrl = (URL) source;
            String urlString = Transformer.string(convertedUrl);
            return urlString;
          } else {
            throw new ConversionException("Not a valid URL: "
                + source);
          }
        } else {
          throw new ConversionException("Not a valid URL: " + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in UrlConverter: " + targetClass.getName() + " - "
          + e.getMessage());
View Full Code Here


            if (booleanString.equals("")) {
              return null;
            }
            logic = Transformer.logic(booleanString);
            if (logic == null) {
              throw new ConversionException(
                  "Not a valid Boolean: " + source);
            }
          } else {
            throw new ConversionException("Not a valid Boolean: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from Boolean to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Boolean) {
            Boolean convertedBoolean = (Boolean) source;
            String booleanString = Transformer
                .string(convertedBoolean);
            return booleanString;
          } else {
            throw new ConversionException("Not a valid Boolean: "
                + source);
          }
        } else {
          throw new ConversionException("Not a valid Boolean: "
              + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in BooleanConverter: " + targetClass.getName()
View Full Code Here

            if (dateString.equals("")) {
              return null;
            } else {
              date = Transformer.date(dateString, datePattern);
              if (date == null) {
                throw new ConversionException(
                    "Not a valid Date: " + source);
              }
            }
          } else {
            throw new ConversionException("Not a valid Date: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from Date to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Date) {
            Date sourceDate = (Date) source;
            String dateString = Transformer.string(sourceDate,
                datePattern);
            return dateString;
          } else {
            throw new ConversionException("Not a valid Date: "
                + source);
          }
        } else {
          throw new ConversionException("Not a valid Date: " + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in DateConverter: " + targetClass.getName()
          + " - " + e.getMessage());
View Full Code Here

            if (floatString.equals("")) {
              return null;
            }
            floatDecimal = Transformer.floatDecimal(floatString);
            if (floatDecimal == null) {
              throw new ConversionException(
                  "Not a valid Float decimal: " + source);
            }
          } else {
            throw new ConversionException(
                "Not a valid Float decimal: " + source);
          }
        } else if (targetClass == String.class) {
          // from Float to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Float) {
            Float convertedFloat = (Float) source;
            String floatString = Transformer.string(convertedFloat);
            return floatString;
          } else {
            throw new ConversionException(
                "Not a valid Float decimal: " + source);
          }
        } else {
          throw new ConversionException("Not a valid Float decimal: "
              + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in FloatConverter: " + targetClass.getName()
View Full Code Here

            if (emailString.equals("")) {
              return null;
            } else {
              email = Transformer.email(emailString);
              if (email == null) {
                throw new ConversionException("Not a valid Email: "
                    + source);
              }
            }
          } else {
            throw new ConversionException("Not a valid Email: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from Email to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Email) {
            Email convertedEmail = (Email) source;
            String emailString = Transformer.string(convertedEmail);
            return emailString;
          } else {
            throw new ConversionException("Not a valid Email: "
                + source);
          }
        } else {
          throw new ConversionException("Not a valid Email: " + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in EmailConverter: " + targetClass.getName()
          + " - " + e.getMessage());
View Full Code Here

            if (integerString.equals("")) {
              return null;
            }
            integer = Transformer.integer(integerString);
            if (integer == null) {
              throw new ConversionException(
                  "Not a valid Integer: " + source);
            }
          } else {
            throw new ConversionException("Not a valid Integer: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from Integer to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Integer) {
            Integer convertedInteger = (Integer) source;
            String integerString = Transformer
                .string(convertedInteger);
            return integerString;
          } else {
            throw new ConversionException("Not a valid Integer: "
                + source);
          }
        } else {
          throw new ConversionException("Not a valid Integer: "
              + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in IntegerConverter: " + targetClass.getName()
View Full Code Here

              return null;
            }
            longInteger = Transformer
                .longInteger(longIntegerString);
            if (longInteger == null) {
              throw new ConversionException(
                  "Not a valid Long integer: " + source);
            }
          } else {
            throw new ConversionException(
                "Not a valid Long integer: " + source);
          }
        } else if (targetClass == String.class) {
          // from Long to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Long) {
            Long convertedLong = (Long) source;
            String longIntegerString = Transformer
                .string(convertedLong);
            return longIntegerString;
          } else {
            throw new ConversionException(
                "Not a valid Long integer: " + source);
          }
        } else {
          throw new ConversionException("Not a valid Long integer: "
              + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in LongConverter: " + targetClass.getName()
View Full Code Here

            if (doubleString.equals("")) {
              return null;
            }
            decimal = Transformer.doubleDecimal(doubleString);
            if (decimal == null) {
              throw new ConversionException(
                  "Not a valid Double decimal: " + source);
            }
          } else {
            throw new ConversionException("Not a valid Double decimal: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from Double to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Double) {
            Double convertedDouble = (Double) source;
            String doubleString = Transformer
                .string(convertedDouble);
            return doubleString;
          } else {
            throw new ConversionException("Not a valid Double decimal: "
                + source);
          }
        } else {
          throw new ConversionException("Not a valid Double decimal: "
              + source);
        }
      }
    } catch (Exception e) {
      log.error("Error in DoubleConverter: " + targetClass.getName()
View Full Code Here

TOP

Related Classes of 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.