Package org.dozer

Examples of org.dozer.MappingException


    public Object create(BeanCreationDirective directive) {
      DatatypeFactory dataTypeFactory;
      try {
        dataTypeFactory = DatatypeFactory.newInstance();
      } catch (DatatypeConfigurationException e) {
        throw new MappingException(e);
      }
      return dataTypeFactory.newXMLGregorianCalendar();
    }
View Full Code Here


  }

  @Override
  public Method getWriteMethod() throws NoSuchMethodException {
    if (MappingUtils.isBlankOrNull(setMethodName)) {
      throw new MappingException("Custom Map set method not specified for field mapping to class: " + clazz
          + ".  Perhaps the map-set-method wasn't specified in the dozer mapping file?");
    }
    if (writeMethod == null || writeMethod.get() == null) {
      Method method = findMapMethod(clazz, setMethodName, 2);
      writeMethod = new SoftReference<Method>(method);
View Full Code Here

    for (Method method : methods) {
      if (methodName.equals(method.getName()) && method.getParameterTypes().length == parameterCount) {
        return method;
      }
    }
    throw new MappingException("No map method found for class:" + clazz + " and method name:" + methodName);
  }
View Full Code Here

  }

  @Override
  protected Method getReadMethod() throws NoSuchMethodException {
    if (MappingUtils.isBlankOrNull(getMethodName)) {
      throw new MappingException("Custom Map get method not specified for field mapping to class: " + clazz
          + ".  Perhaps the map-get-method wasn't specified in the dozer mapping file?");
    }
    if (readMethod == null || readMethod.get() == null) {
      Method method = findMapMethod(clazz, getMethodName, 1);
      readMethod = new SoftReference<Method>(method);
View Full Code Here

  }

  @Override
  protected void invokeWriteMethod(Object target, Object value) {
    if (key == null) {
      throw new MappingException("key must be specified");
    }
    try {
      ReflectionUtils.invoke(getWriteMethod(), target, new Object[]{key, value});
    } catch (NoSuchMethodException e) {
      MappingUtils.throwMappingException(e);
View Full Code Here

  }

  @Override
  protected Object invokeReadMethod(Object target) {
    if (key == null) {
      throw new MappingException("key must be specified");
    }
    Object result = null;
    try {
      result = ReflectionUtils.invoke(getReadMethod(), target, new Object[]{key});
    } catch (NoSuchMethodException e) {
View Full Code Here

  public DocumentBuilder createParser() {
    DocumentBuilderFactory factory = createDocumentBuilderFactory();
    try {
      return createDocumentBuilder(factory);
    } catch (ParserConfigurationException e) {
      throw new MappingException("Failed to create XML Parser !", e);
    }
  }
View Full Code Here

    assertEquals("invalid result value", "String", result);
  }

  @Test(expected=MappingException.class)
  public void testThrowMappingException_MappingException() {
    MappingException ex = new MappingException(String.valueOf(System.currentTimeMillis()));
      MappingUtils.throwMappingException(ex);
      fail("should have thrown exception");
  }
View Full Code Here

              }
              if (existingPropDescriptor.getWriteMethod() == null) {
                existingPropDescriptor.setWriteMethod(superPropDescriptor.getWriteMethod());
              }
            } catch (IntrospectionException e) {
              throw new MappingException(e);
            }

          }
        }
      }
View Full Code Here

      return field;
    } catch (NoSuchFieldException e) {
      if (clazz.getSuperclass() != null) {
        return getFieldFromBean(clazz.getSuperclass(), fieldName, originalClass);
      }
      throw new MappingException("No such field found " + originalClass.getName() + "." + fieldName, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.dozer.MappingException

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.