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

org.apache.openejb.jee.Beans Maven / Gradle / Ivy

The newest version!
/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
package org.apache.openejb.jee;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;


/**
 * 

Java class for anonymous complex type. *

*

The following schema fragment specifies the expected content contained within this class. *

*

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <all>
 *         <element ref="{http://java.sun.com/xml/ns/javaee}interceptors" minOccurs="0"/>
 *         <element ref="{http://java.sun.com/xml/ns/javaee}decorators" minOccurs="0"/>
 *         <element ref="{http://java.sun.com/xml/ns/javaee}alternatives" minOccurs="0"/>
 *       </all>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
*/ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { }) @XmlRootElement(name = "beans") public class Beans { @XmlTransient protected List duplicatedInterceptors; @XmlTransient protected List duplicatedDecorators; @XmlTransient protected Alternatives duplicatedAlternatives; @XmlTransient protected List startupBeans; @XmlTransient private final List managedClasses = new ArrayList(); @XmlElementWrapper(name = "interceptors") @XmlElement(name = "class") protected List interceptors; @XmlElementWrapper(name = "decorators") @XmlElement(name = "class") protected List decorators; protected Alternatives alternatives; public List getManagedClasses() { return managedClasses; } public void addManagedClass(final String className) { managedClasses.add(className); } public void addManagedClass(final Class clazz) { addManagedClass(clazz.getName()); } public List getStartupBeans() { if (startupBeans == null) { startupBeans = new LinkedList(); } return startupBeans; } public List getInterceptors() { if (interceptors == null) { interceptors = new ArrayList(); } return interceptors; } public void addInterceptor(final String className) { getInterceptors().add(className); } public void addInterceptor(final Class clazz) { addInterceptor(clazz.getName()); } public List getDecorators() { if (decorators == null) { decorators = new ArrayList(); } return decorators; } public void addDecorator(final String className) { getDecorators().add(className); } public void addDecorator(final Class clazz) { addDecorator(clazz.getName()); } public List getAlternativeClasses() { return getAlternatives().getClasses(); } public void addAlternativeClass(final String className) { getAlternativeClasses().add(className); } public void addAlternativeClass(final Class clazz) { addAlternativeClass(clazz.getName()); } public List getAlternativeStereotypes() { return getAlternatives().getStereotypes(); } public void addAlternativeStereotype(final String className) { getAlternativeStereotypes().add(className); } public void addAlternativeStereotype(final Class clazz) { addAlternativeStereotype(clazz.getName()); } /** * Gets the value of the alternatives property. * * @return possible object is * {@link Alternatives } */ private Alternatives getAlternatives() { if (alternatives == null) { alternatives = new Alternatives(); } return alternatives; } /** *

Java class for anonymous complex type. *

*

The following schema fragment specifies the expected content contained within this class. *

*

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <choice maxOccurs="unbounded" minOccurs="0">
     *         <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *         <element name="stereotype" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *       </choice>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     * 
*/ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "classes", "stereotypes" }) @XmlRootElement(name = "alternatives") public static class Alternatives { @XmlElement(name = "class") protected List classes; @XmlElement(name = "stereotype") protected List stereotypes; public List getClasses() { if (classes == null) { classes = new ArrayList(); } return classes; } public List getStereotypes() { if (stereotypes == null) { stereotypes = new ArrayList(); } return stereotypes; } } public List getDuplicatedInterceptors() { if (duplicatedInterceptors == null) { duplicatedInterceptors = new ArrayList(); } return duplicatedInterceptors; } public List getDuplicatedDecorators() { if (duplicatedDecorators == null) { duplicatedDecorators = new ArrayList(); } return duplicatedDecorators; } public Alternatives getDuplicatedAlternatives() { if (duplicatedAlternatives == null) { duplicatedAlternatives = new Alternatives(); } return duplicatedAlternatives; } public void removeDuplicates() { removeDuplicates(getAlternativeClasses()); removeDuplicates(getAlternativeStereotypes()); removeDuplicates(getDecorators()); removeDuplicates(getInterceptors()); } private void removeDuplicates(final List list) { // don't use a set to keep order final List classes = new ArrayList(); for (final T t : list) { if (!classes.contains(t)) { classes.add(t); } } list.clear(); list.addAll(classes); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy