Package com.alibaba.toolkit.util.typeconvert

Examples of com.alibaba.toolkit.util.typeconvert.ConvertManager


        }

        if (value.getClass().isArray()) {
            int            length          = Array.getLength(value);
            Object         convertedValues = Array.newInstance(componentType, length);
            ConvertManager manager         = chain.getConvertManager();

            for (int i = 0; i < length; i++) {
                Array.set(convertedValues, i, manager.asType(componentType, Array.get(value, i)));
            }

            return convertedValues;
        }

        if (value instanceof Collection) {
            Collection     values          = (Collection) value;
            Object         convertedValues = Array.newInstance(componentType, values.size());
            ConvertManager manager         = chain.getConvertManager();

            Iterator       iterator = values.iterator();

            for (int i = 0; iterator.hasNext(); i++) {
                Array.set(convertedValues, i, manager.asType(componentType, iterator.next()));
            }

            return convertedValues;
        }

        Iterator iterator = null;

        if (value instanceof Iterator) {
            iterator = (Iterator) value;
        } else if (value instanceof Enumeration) {
            iterator = new EnumerationIterator((Enumeration) value);
        }

        if (iterator != null) {
            List           convertedValueList = new ArrayList();
            ConvertManager manager = chain.getConvertManager();

            while (iterator.hasNext()) {
                convertedValueList.add(manager.asType(componentType, iterator.next()));
            }

            int    length          = convertedValueList.size();
            Object convertedValues = Array.newInstance(componentType, length);
View Full Code Here


        }

        if (value.getClass().isArray()) {
            int length = Array.getLength(value);
            Object convertedValues = Array.newInstance(componentType, length);
            ConvertManager manager = chain.getConvertManager();

            for (int i = 0; i < length; i++) {
                Array.set(convertedValues, i, manager.asType(componentType, Array.get(value, i)));
            }

            return convertedValues;
        }

        if (value instanceof Collection) {
            Collection values = (Collection) value;
            Object convertedValues = Array.newInstance(componentType, values.size());
            ConvertManager manager = chain.getConvertManager();

            Iterator iterator = values.iterator();

            for (int i = 0; iterator.hasNext(); i++) {
                Array.set(convertedValues, i, manager.asType(componentType, iterator.next()));
            }

            return convertedValues;
        }

        Iterator iterator = null;

        if (value instanceof Iterator) {
            iterator = (Iterator) value;
        } else if (value instanceof Enumeration) {
            iterator = new EnumerationIterator((Enumeration) value);
        }

        if (iterator != null) {
            List convertedValueList = new ArrayList();
            ConvertManager manager = chain.getConvertManager();

            while (iterator.hasNext()) {
                convertedValueList.add(manager.asType(componentType, iterator.next()));
            }

            int length = convertedValueList.size();
            Object convertedValues = Array.newInstance(componentType, length);
View Full Code Here

        }

        if (value.getClass().isArray()) {
            int            length          = Array.getLength(value);
            Object         convertedValues = Array.newInstance(componentType, length);
            ConvertManager manager         = chain.getConvertManager();

            for (int i = 0; i < length; i++) {
                Array.set(convertedValues, i, manager.asType(componentType, Array.get(value, i)));
            }

            return convertedValues;
        }

        if (value instanceof Collection) {
            Collection     values          = (Collection) value;
            Object         convertedValues = Array.newInstance(componentType, values.size());
            ConvertManager manager         = chain.getConvertManager();

            Iterator       iterator = values.iterator();

            for (int i = 0; iterator.hasNext(); i++) {
                Array.set(convertedValues, i, manager.asType(componentType, iterator.next()));
            }

            return convertedValues;
        }

        Iterator iterator = null;

        if (value instanceof Iterator) {
            iterator = (Iterator) value;
        } else if (value instanceof Enumeration) {
            iterator = new EnumerationIterator((Enumeration) value);
        }

        if (iterator != null) {
            List           convertedValueList = new ArrayList();
            ConvertManager manager = chain.getConvertManager();

            while (iterator.hasNext()) {
                convertedValueList.add(manager.asType(componentType, iterator.next()));
            }

            int    length          = convertedValueList.size();
            Object convertedValues = Array.newInstance(componentType, length);
View Full Code Here

TOP

Related Classes of com.alibaba.toolkit.util.typeconvert.ConvertManager

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.