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

net.sf.andromedaioc.model.builder.xml.XmlContextElement Maven / Gradle / Ivy

The newest version!
package net.sf.andromedaioc.model.builder.xml;

import java.util.*;

public enum XmlContextElement {

    BEANS("beans"),
    BEAN("bean", true),
    ID("id"),
    CLASS("class"),
    INIT_METHOD("initMethod"),
    ABSTRACT("abstract"),
    PARENT("parent"),
    SCOPE("scope"),
    FACTORY_METHOD("factoryMethod"),
    FACTORY_BEAN("factoryBean"),
    PROPERTY("property"),
    NAME("name"),
    VALUE("value"),
    REFERENCE("ref"),
    CONSTRUCTOR_ARGUMENT("constructor-arg"),
    INDEX("index"),
    TYPE("type"),
    LIST("list", true, ArrayList.class, true, false, List.class),
    SET("set", true, LinkedHashSet.class, true, false, Set.class),
    MAP("map", true, LinkedHashMap.class, false, true, Map.class),
    ITEM("item"),
    ENTRY("entry"),
    KEY_TYPE("keyType"),
    VALUE_TYPE("valueType"),
    KEY("key"),
    KEY_REF("keyRef"),
    VALUE_REF("valueRef");

    private final static Map elementByName;
    static {
        elementByName = new HashMap();
        for(XmlContextElement element : values()) {
            elementByName.put(element.getName(), element);
        }
    }

    private final String name;
    private final Class defaultType;
    private final boolean collection;
    private final boolean map;
    private final boolean bean;
    private final Class baseType;

    private XmlContextElement(String name) {
        this(name, false);
    }

    private XmlContextElement(String name, boolean bean) {
        this(name, bean, null, false, false, null);
    }

    private XmlContextElement(String name, boolean bean, Class defaultType, boolean collection, boolean map, Class baseType) {
        this.name = name;
        this.defaultType = defaultType;
        this.collection = collection;
        this.map = map;
        this.bean = bean;
        this.baseType = baseType;
    }

    public String getName() {
        return name;
    }

    public Class getDefaultType() {
        return defaultType;
    }

    public boolean isCollection() {
        return collection;
    }

    public boolean isMap() {
        return map;
    }

    public boolean isBean() {
        return bean;
    }

    public static XmlContextElement getByName(String name) {
        return elementByName.get(name);
    }

    public Class getBaseType() {
        return baseType;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy