Package ma.glasnost.orika.impl.mapping.strategy

Examples of ma.glasnost.orika.impl.mapping.strategy.MappingStrategy


    protected void mapArray(double[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Double) strategy.map(s, null, mappingContext);
        }
    }
View Full Code Here


            this.mapperFacade = mapperFacade;
            this.inPlace = inPlace;
        }
       
        public MappingStrategy getStrategy(Object sourceObject, MappingContext context) {
            MappingStrategy strategy = null;
            if (defaultStrategy != null && sourceObject.getClass().equals(idClass)) {
                strategy = defaultStrategy;
            } else if (defaultStrategy == null) {
                synchronized(this) {
                    if (defaultStrategy == null) {
                        defaultStrategy = mapperFacade.resolveMappingStrategy(sourceObject, aType, bType, inPlace, context);
                        idClass = sourceObject.getClass();
                    }
                }
                strategy = defaultStrategy;
            } else {
                strategy = strategies.get(sourceObject.getClass());
                if (strategy == null) {
                    strategy = mapperFacade.resolveMappingStrategy(sourceObject, aType, bType, inPlace, context);
                    strategies.put(sourceObject.getClass(), strategy);
                }
            }
           
            /*
             * Set the resolved types on the current mapping context; this can be used
             * by downstream Mappers to determine the originally resolved types
             */
            context.setResolvedSourceType(strategy.getSoureType());
            context.setResolvedDestinationType(strategy.getDestinationType());
           
            return strategy;
        }
View Full Code Here

    protected void mapArray(byte[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Byte) strategy.map(s, null, mappingContext);
        }
    }
View Full Code Here

    protected void mapArray(boolean[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Boolean) strategy.map(s, null, mappingContext);
        }
       
    }
View Full Code Here

    protected void mapArray(char[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Character) strategy.map(s, null, mappingContext);
        }
       
    }
View Full Code Here

    protected void mapArray(short[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Short) strategy.map(s, null, mappingContext);
        }
       
    }
View Full Code Here

    protected void mapArray(int[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Integer) strategy.map(s, null, mappingContext);
        }
       
    }
View Full Code Here

    protected void mapArray(long[] destination, List<Object> source, Class<?> clazz, MappingContext mappingContext) {
        if (source == null) {
            return;
        }
       
        MappingStrategy strategy = null;
        Class<?> entryClass = null;
        int i = 0;
        for (final Object s : source) {
            if (strategy == null || !s.getClass().equals(entryClass)) {
                strategy = mapperFacade.resolveMappingStrategy(s, null, clazz, false, mappingContext);
                entryClass = s.getClass();
            }
            destination[i++] = (Long) strategy.map(s, null, mappingContext);
        }
       
    }
View Full Code Here

TOP

Related Classes of ma.glasnost.orika.impl.mapping.strategy.MappingStrategy

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.