Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * [SIMINOV FRAMEWORK - CORE]
 * Copyright [2014-2016] [Siminov Software Solution LLP|support@siminov.com]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

import java.sql.Blob;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

public class Main {
    private static Class<?>[] convertToPrimitiveClasses(Class<?>... classes) {

        Collection<Class<?>> convertedClasses = new HashSet<Class<?>>();
        for (Class<?> classObject : classes) {

            if (classObject.getName().equalsIgnoreCase(Integer.class.getName())) {
                convertedClasses.add(int.class);
            } else if (classObject.getName().equalsIgnoreCase(Long.class.getName())) {
                convertedClasses.add(long.class);
            } else if (classObject.getName().equalsIgnoreCase(Float.class.getName())) {
                convertedClasses.add(float.class);
            } else if (classObject.getName().equalsIgnoreCase(Double.class.getName())) {
                convertedClasses.add(double.class);
            } else if (classObject.getName().equalsIgnoreCase(Boolean.class.getName())) {
                convertedClasses.add(boolean.class);
            } else if (classObject.getName().equalsIgnoreCase(Blob.class.getName())) {
                convertedClasses.add(byte.class);
            } else {
                convertedClasses.add(classObject);
            }
        }

        Class<?>[] convertedArrayClasses = new Class<?>[convertedClasses.size()];
        Iterator<Class<?>> convertedClassesItr = convertedClasses.iterator();

        int count = 0;
        while (convertedClassesItr.hasNext()) {
            convertedArrayClasses[count++] = convertedClassesItr.next();
        }

        return convertedArrayClasses;
    }
}