Package org.springframework.beans

Examples of org.springframework.beans.TypeMismatchException


                : 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 == null ) {
      return;
    }

    if ( !propertyType.isAssignableFrom( value.getClass() ) ) {
      throw new TypeMismatchException( value, propertyType );
    }
  }
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

                                : 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

  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

      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

    testException(ex);
  }

  @Test
  public void typeMismatch() {
    Exception ex = new TypeMismatchException("foo", String.class);
    testException(ex);
  }
View Full Code Here

    assertEquals("Invalid status code", 400, response.getStatus());
  }

  @Test
  public void handleTypeMismatch() {
    TypeMismatchException ex = new TypeMismatchException("foo", String.class);
    ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
    assertNotNull("No ModelAndView returned", mav);
    assertTrue("No Empty ModelAndView returned", mav.isEmpty());
    assertEquals("Invalid status code", 400, response.getStatus());
  }
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.