de.topobyte.collections.util.gen.GenCollectionToArray.java Source code

Java tutorial

Introduction

Here is the source code for de.topobyte.collections.util.gen.GenCollectionToArray.java

Source

// Copyright 2015 Sebastian Kuerten
//
// This file is part of collections-utils.
//
// collections-utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// collections-utils is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with collections-utils. If not, see <http://www.gnu.org/licenses/>.

package de.topobyte.collections.util.gen;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

/**
 * @author Sebastian Kuerten (sebastian@topobyte.de)
 */
public class GenCollectionToArray {

    public static void main(String[] args) throws IOException {
        InputStream input = Thread.currentThread().getContextClassLoader()
                .getResourceAsStream("collectionAsArray.template");
        String template = IOUtils.toString(input);

        for (PrimitiveType type : PrimitiveType.values()) {
            System.out.println(InstanceCreator.create(template, type));
        }
    }

}