All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fastchar.extjs.acceptor.FastExtEnumAcceptor Maven / Gradle / Ivy

Go to download

FastChar-ExtJs is a Java Web framework that uses extjs libraries.Quickly build a background management system

There is a newer version: 2.2.2
Show newest version
package com.fastchar.extjs.acceptor;

import com.fastchar.core.FastChar;
import com.fastchar.core.FastEngine;
import com.fastchar.interfaces.IFastScannerAcceptor;
import com.fastchar.utils.FastClassUtils;

import java.util.HashMap;
import java.util.Map;

@SuppressWarnings("unchecked")
public class FastExtEnumAcceptor implements IFastScannerAcceptor {

    public static Map>> ENUM_MAP = new HashMap<>();

    @Override
    public void onScannerClass(FastEngine engine, Class scannedClass) throws Exception {
        if (scannedClass.isEnum()) {
            if (!FastClassUtils.checkNewInstance(scannedClass)) {
                return;
            }
            if (ENUM_MAP.containsKey(scannedClass.getSimpleName())) {
                Class> existEnumClass = ENUM_MAP.get(scannedClass.getSimpleName());
                if (FastClassUtils.isSameClass(existEnumClass, scannedClass)) {
                    return;
                }
                String errorInfo = FastChar.getLocal().getInfo("ExtEnum_Error1", scannedClass.getSimpleName());

                StackTraceElement newStack = new StackTraceElement(scannedClass.getName(), scannedClass.getSimpleName(),
                        scannedClass.getSimpleName() + ".java", 1);

                StackTraceElement existStack = new StackTraceElement(existEnumClass.getName(), existEnumClass.getSimpleName(),
                        existEnumClass.getSimpleName() + ".java", 1);

                FastChar.getLogger().warn(this.getClass(), errorInfo +
                        "\n\tcurr at " + newStack +
                        "\n\texist at " + existStack
                );
            }
            ENUM_MAP.put(scannedClass.getSimpleName(), (Class>) scannedClass);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy