Package org.springframework.beans

Examples of org.springframework.beans.TypeMismatchException


        try {
            result = AttributableUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Attributable not supported: " + kind);

            throw new TypeMismatchException(kind, AttributableUtil.class, e);
        }

        return result;
    }
View Full Code Here


        try {
            result = TaskUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Task not supported: " + kind);

            throw new TypeMismatchException(kind, TaskUtil.class, e);
        }

        return result;
    }
View Full Code Here

                                        : null;

        if (result == null) {
            LOG.error("Task not supported: " + task.getClass().getName());

            throw new TypeMismatchException(task.getClass().getName(), TaskUtil.class);
        }

        return result;
    }
View Full Code Here

                                : null;

        if (result == null) {
            LOG.error("Task not supported: " + taskTO.getClass().getName());

            throw new TypeMismatchException(taskTO.getClass().getName(), TaskUtil.class);
        }

        return result;
    }
View Full Code Here

      if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
        try {
          return new Float(this.numberFormat.parse((String) value).floatValue());
        }
        catch (ParseException ex) {
          throw new TypeMismatchException(value, requiredType, ex);
        }
      }
      else if (value instanceof String && int.class.isAssignableFrom(requiredType)) {
        return new Integer(5);
      }
View Full Code Here

  protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws IOException {
    Assert.notNull(this.unmarshaller, "Property 'unmarshaller' is required");
    try {
      Object result = this.unmarshaller.unmarshal(source);
      if (!clazz.isInstance(result)) {
        throw new TypeMismatchException(result, clazz);
      }
      return result;
    }
    catch (UnmarshallingFailureException ex) {
      throw new HttpMessageNotReadableException("Could not read [" + clazz + "]", ex);
View Full Code Here

  }

  public void testGetMessageCodeForException() {
    DefaultBindingErrorMessageProvider provider = new DefaultBindingErrorMessageProvider();

    assertEquals("typeMismatch", provider.getMessageCodeForException(new TypeMismatchException(new Object(),
        String.class)));
    assertEquals("required", provider.getMessageCodeForException(new NullPointerException()));
    assertEquals("typeMismatch", provider.getMessageCodeForException(new InvalidFormatException("", "")));
    assertEquals("typeMismatch", provider.getMessageCodeForException(new IllegalArgumentException()));
    assertEquals("required", provider.getMessageCodeForException(new RuntimeException(new NullPointerException())));
View Full Code Here

        try {
            result = AttributableUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Attributable not supported: " + kind);

            throw new TypeMismatchException(kind, AttributableUtil.class, e);
        }

        return result;
    }
View Full Code Here

        try {
            result = TaskUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Task not supported: " + kind);

            throw new TypeMismatchException(kind, TaskUtil.class, e);
        }

        return result;
    }
View Full Code Here

                : null;

        if (result == null) {
            LOG.error("Task not supported: " + task.getClass().getName());

            throw new TypeMismatchException(task.getClass().getName(), TaskUtil.class);
        }

        return result;
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.TypeMismatchException

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.