Package org.dozer.classmap

Examples of org.dozer.classmap.MappingFileData


            return Collections.emptyList();
        }

        for (String name : mappingFiles) {
            URL url = camelContext.getClassResolver().loadResourceAsURL(name);
            MappingFileData data = reader.read(url);
            answer.addAll(data.getClassMaps());
        }

        return answer;
    }
View Full Code Here


                    + ". Mapping has not been registered!");
            return;
        }

        mapper.addMapping(beanMappingBuilder);
        MappingFileData mappingFileData = beanMappingBuilder.build();
        TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
        ArrayList<ClassMap> classMaps = new ArrayList<ClassMap>();
        classMaps.addAll(mappingFileData.getClassMaps());
        registerClassMaps(registry, mapper, classMaps);
    }
View Full Code Here

            return Collections.emptyList();
        }

        for (String name : mappingFiles) {
            URL url = camelContext.getClassResolver().loadResourceAsURL(name);
            MappingFileData data = reader.read(url);
            answer.addAll(data.getClassMaps());
        }

        return answer;
    }
View Full Code Here

                    + ". Mapping has not been registered!");
            return;
        }

        mapper.addMapping(beanMappingBuilder);
        MappingFileData mappingFileData = beanMappingBuilder.build();
        TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
        List<ClassMap> classMaps = new ArrayList<ClassMap>();
        classMaps.addAll(mappingFileData.getClassMaps());
        registerClassMaps(registry, mapper, classMaps);
    }
View Full Code Here

    URL url = loader.getResource(fileName);
    return read(url);
  }

  public MappingFileData read(URL url) {
    MappingFileData result = null;
    InputStream stream = null;
    try {
      stream = url.openStream();
      Document document = documentBuilder.parse(stream);
     
View Full Code Here

      InitLogger.log(log, "Using the following xml files to load custom mappings for the bean mapper instance: " + mappingFiles);
      for (String mappingFileName : mappingFiles) {
        InitLogger.log(log, "Trying to find xml mapping file: " + mappingFileName);
        URL url = MappingValidator.validateURL(mappingFileName);
        InitLogger.log(log, "Using URL [" + url + "] to load custom xml mappings");
        MappingFileData mappingFileData = mappingFileReader.read(url);
        InitLogger.log(log, "Successfully loaded custom xml mappings from URL: [" + url + "]");

        mappingFileDataList.add(mappingFileData);
      }
    }
View Full Code Here

* @author dmitry.buzdin
*/
public class AnnotationLoader implements MappingsSource {

  public MappingFileData load() {
    return new MappingFileData();
    // TODO Scan classpath and find all Beans marked for mapping
  }
View Full Code Here

    URL url = classLoader.loadResource(fileName);
    return read(url);
  }

  public MappingFileData read(URL url) {
    MappingFileData result = null;
    InputStream stream = null;
    try {
      stream = url.openStream();
      result = streamReader.read(stream);
    } catch (IOException e) {
View Full Code Here

  }

  @Test
  public void testOverridenFields() throws Exception {
    MappingFileReader fileReader = new MappingFileReader(XMLParserFactory.getInstance());
    MappingFileData mappingFileData = fileReader.read("overridemapping.xml");
    MappingsParser mappingsParser = MappingsParser.getInstance();
    mappingsParser.processMappings(mappingFileData.getClassMaps(), mappingFileData.getConfiguration());
    // validate class mappings
    for (ClassMap classMap : mappingFileData.getClassMaps()) {
      if (classMap.getSrcClassToMap().getName().equals("org.dozer.util.mapping.vo.FurtherTestObject")) {
        assertTrue(classMap.isStopOnErrors());
      }
      if (classMap.getSrcClassToMap().getName().equals("org.dozer.util.mapping.vo.SuperSuperSuperClass")) {
        assertTrue(classMap.isWildcard());
View Full Code Here

  }

  @Test(expected=IllegalArgumentException.class)
  public void testDuplicateMapIds() throws Exception {
    MappingFileReader fileReader = new MappingFileReader(XMLParserFactory.getInstance());
    MappingFileData mappingFileData = fileReader.read("duplicateMapIdsMapping.xml");

    parser.processMappings(mappingFileData.getClassMaps(), new Configuration());
    fail("should have thrown exception");
  }
View Full Code Here

TOP

Related Classes of org.dozer.classmap.MappingFileData

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.