Package org.dozer

Examples of org.dozer.MappingException


  public boolean mapField(Object sourceObj, Object destObj, Object sourceFieldValue, ClassMap classMap, FieldMap fieldMapping) {
    boolean result = false;

    if (!(sourceObj instanceof SimpleObj)) {
      throw new MappingException("Unsupported source object type.  Should be of type: SimpleObj");
    }

    if (!(destObj instanceof SimpleObjPrime)) {
      throw new MappingException("Unsupported dest object type.  Should be of type: SimpleObjPrime");
    }

    if (fieldMapping.getSrcFieldName().equals("field1")) {
      ((SimpleObjPrime) destObj).setField1(FIELD_VALUE);
      result = true;
View Full Code Here


      return dest;
    } else if (source instanceof CustomDoubleObject) {
      double sourceObj = ((CustomDoubleObjectIF) source).getTheDouble();
      return new Double(sourceObj);
    } else {
      throw new MappingException("Converter TestCustomConverter used incorrectly. Arguments passed in were:" + destination
          + " and " + source);
    }
  }
View Full Code Here

    Class newClass = proxyFactory.createClass();
    Object instance;
    try {
      instance = newClass.newInstance();
    } catch (Exception e) {
      throw new MappingException(e);
    }
    return (T) instance;
  }
View Full Code Here

      }
      dest.setTestObject((TestObject) testCustomConverterHashMapPrimeObject.getTestObjects().get("object1"));
      dest.setTestObjectPrime((TestObjectPrime) testCustomConverterHashMapPrimeObject.getTestObjects().get("object2"));
      return dest;
    } else {
      throw new MappingException("Converter TestCustomHashMapConverter used incorrectly. Arguments passed in were:" + destination
          + " and " + source);
    }
  }
View Full Code Here

  public DozerField getSrcFieldCopy() {
    try {
      return (DozerField) srcField.clone();
    } catch (CloneNotSupportedException e) {
      throw new MappingException(e);
    }
  }
View Full Code Here

  public DozerField getDestFieldCopy() {
    try {
      return (DozerField) destField.clone();
    } catch (CloneNotSupportedException 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

    classMap.addFieldMapping(fieldMap);
  }

  private static void validate(Mapping annotation, Member member) {
    if (annotation.value().trim().equals("")) {
      throw new MappingException("Mapping annotation value missing at "
              + member.getDeclaringClass().getName() + "." + member.getName());
    }
  }
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

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.