Package org.dozer

Examples of org.dozer.MappingException


      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


          if (field.get(bean) == null) {
            Object dependency = wireBean(fieldType);
            field.set(bean, dependency);
          }
        } catch (IllegalAccessException e) {
          throw new MappingException("Field annotated with @Inject is not accessible : " + field.getName(), e);
        }
      }
    }

    Object[] instance = beans.get(type);
View Full Code Here

    if (returnType != null) {
      return returnType;
    }

    if (readMethod == null && writeMethod == null) {
      throw new MappingException("No read or write method found for field (" + fieldName
              + ") in class (" + clazz + ")");
    }

    if (readMethod == null) {
      return determineByWriteMethod(writeMethod);
View Full Code Here

  private Class determineByWriteMethod(Method writeMethod) {
    try {
      return writeMethod.getParameterTypes()[0];
    } catch (Exception e) {
      throw new MappingException(e);
    }
  }
View Full Code Here

  private static DatatypeFactory dataTypeFactory() {
    if (dataTypeFactory == null) {
      try {
        dataTypeFactory = DatatypeFactory.newInstance();
      } catch (DatatypeConfigurationException e) {
        throw new MappingException(e);
      }
    }
    return dataTypeFactory;
  }
View Full Code Here

    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

  }

  private static DozerField prepareField(String name, String type) {
    if (MappingUtils.isBlankOrNull(name)) {
      throw new MappingException("Field name can not be empty");
    }
    String fieldName;
    String fieldType = null;
    if (isIndexed(name)) {
      fieldName = getFieldNameOfIndexedField(name);
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

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.