[webbeans-commits] Webbeans SVN: r536 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: bootstrap and 4 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Dec 16 15:22:29 EST 2008
Author: nickarls
Date: 2008-12-16 15:22:29 -0500 (Tue, 16 Dec 2008)
New Revision: 536
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSF.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ApiAbstraction.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
Log:
Some weird comments :-P
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -143,7 +143,15 @@
{
return new InstanceBean<T, S>(field, manager);
}
-
+
+ /**
+ * Creates an observer
+ *
+ * @param method The observer method abstraction
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ * @return An observer implementation built from the method abstraction
+ */
public static <T> ObserverImpl<T> createObserver(AnnotatedMethod<Object> method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
{
return new ObserverImpl<T>(method, declaringBean, manager);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -55,6 +55,7 @@
{
private LogProvider log = Logging.getLogProvider(EnterpriseBean.class);
+ // The EJB descriptor
private EjbDescriptor<T> ejbDescriptor;
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -79,9 +79,9 @@
{
// The property name of the discovery class
public static String WEB_BEAN_DISCOVERY_PROPERTY_NAME = "org.jboss.webbeans.bootstrap.webBeanDiscovery";
-
+ // The log provider
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
-
+ // The Web Beans manager
protected ManagerImpl manager;
/**
@@ -124,6 +124,11 @@
manager.setBeans(beans);
}
+ /**
+ * Creates the standard beans used internally by the RI
+ *
+ * @return A set containing the created beans
+ */
protected Set<AbstractBean<?, ?>> createStandardBeans()
{
Set<AbstractBean<?, ?>> beans = new HashSet<AbstractBean<?, ?>>();
@@ -161,6 +166,14 @@
return beans;
}
+ /**
+ * Creates a Web Bean from a bean abstraction and adds it to the set of created beans
+ *
+ * Also creates the implicit field- and method-level beans, if present
+ *
+ * @param bean The bean representation
+ * @param beans The set of created beans
+ */
@SuppressWarnings("unchecked")
protected void createBean(AbstractClassBean<?> bean, Set<AbstractBean<?, ?>> beans)
{
@@ -285,13 +298,26 @@
}
return webBeanDiscoveryClasses;
}
-
+
+ /**
+ * Registers an observer with the manager
+ *
+ * @param observer The observer
+ * @param eventType The event type to observe
+ * @param bindings The binding types to observe on
+ */
@SuppressWarnings("unchecked")
private <T> void registerObserver(Observer<T> observer, Class<?> eventType, Annotation[] bindings)
{
manager.addObserver(observer, (Class<T>) eventType, bindings);
}
+ /**
+ * Indicates if the type is a simple Web Bean
+ *
+ * @param type The type to inspect
+ * @return True if simple Web Bean, false otherwise
+ */
protected static boolean isTypeSimpleWebBean(Class<?> type)
{
return !type.isAnnotation() && !Reflections.isAbstract(type) && !SERVLET_CLASS.isAssignableFrom(type) && !FILTER_CLASS.isAssignableFrom(type) && !SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(type) && !HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(type) && !SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(type) && !ENTERPRISE_BEAN_CLASS.isAssignableFrom(type) && !UICOMPONENT_CLASS.isAssignableFrom(type);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,8 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
+package org.jboss.webbeans.bootstrap.spi;
+
/**
+ * Represents the business interface of an EJB
*
+ * @author Pete Muir
+ *
+ * @param <T>
*/
-package org.jboss.webbeans.bootstrap.spi;
-
public interface BusinessInterfaceDescriptor<T>
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -53,37 +53,42 @@
/**
* Get the remove methods of the EJB
*
- * @return An iterator the remove methods
+ * @return An iterator over the remove methods
*/
public Iterable<Method> getRemoveMethods();
/**
- * The type of EJB
- * @return true if the bean is stateless
+ * Indicates if the bean is stateless
+ *
+ * @return True if stateless, false otherwise
*/
public boolean isStateless();
/**
- * The type of EJB
- * @return true if the bean is an EJB 3.1 singleton
+ * Indicates if the bean is a EJB 3.1 Singleton
+ *
+ * @return True if the bean is a singleton, false otherwise
*/
public boolean isSingleton();
/**
- * The type of EJB
- * @return true if the bean is stateful
+ * Indicates if the EJB is stateful
+ *
+ * @return True if the bean is stateful, false otherwise
*/
public boolean isStateful();
/**
- * The type of EJB
- * @return true if the bean is an MDB
+ * Indicates if the EJB is and MDB
+ *
+ * @return True if the bean is an MDB, false otherwise
*/
public boolean isMessageDriven();
/**
+ * Gets the EJB name
*
- * @return The ejbName
+ * @return The name
*/
public String getEjbName();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -34,6 +34,12 @@
public class DefaultEnterpriseBeanLookup implements EnterpriseBeanLookup
{
+ /**
+ * Looks up and EJB based on the name
+ *
+ * @param ejbName The EJB name
+ * @return The EJB reference
+ */
public Object lookup(String ejbName)
{
if (ejbName == null)
@@ -43,6 +49,13 @@
return lookup(EjbDescriptorCache.instance().get(ejbName));
}
+ /**
+ * Looks up an EJB based on the EJB descriptor
+ *
+ * @param <T> The type of the EJB
+ * @param ejbDescriptor The EJB descriptor
+ * @return The EJB reference
+ */
@SuppressWarnings("unchecked")
public static <T> T lookup(EjbDescriptor<T> ejbDescriptor)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
package org.jboss.webbeans.ejb;
import java.util.Set;
@@ -7,56 +24,109 @@
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+/**
+ * Singleton for accessing EJB descriptors by EJB implementation class or name
+ *
+ * @author Pete Muir
+ *
+ */
public class EjbDescriptorCache
{
+ // The singleton
private static EjbDescriptorCache instance;
+ /**
+ * Accessor for the singleton
+ *
+ * @return The instance
+ */
public static EjbDescriptorCache instance()
{
return instance;
}
+ // Static initalizer block
static
{
instance = new EjbDescriptorCache();
}
+ // EJB name -> EJB descriptor map
private ConcurrentMap<String, EjbDescriptor<?>> ejbsByName;
+ // EJB implementation class -> EJB descriptors map
private ConcurrentMap<Class<?>, Set<EjbDescriptor<?>>> ejbsByBeanClass;
+ /**
+ * Constructor
+ */
public EjbDescriptorCache()
{
this.ejbsByName = new ConcurrentHashMap<String, EjbDescriptor<?>>();
this.ejbsByBeanClass = new ConcurrentHashMap<Class<?>, Set<EjbDescriptor<?>>>();
}
+ /**
+ * Gets the EJB descriptor for a given name
+ *
+ * @param ejbName The EJB name
+ * @return The EJB descriptor
+ */
public EjbDescriptor<?> get(String ejbName)
{
return ejbsByName.get(ejbName);
}
-
+
+ /**
+ * Gets an iterator to the EJB descriptors for an EJB implementation class
+ *
+ * @param beanClass The EJB class
+ * @return An iterator
+ */
public Iterable<EjbDescriptor<?>> get(Class<?> beanClass)
{
return ejbsByBeanClass.get(beanClass);
}
+ /**
+ * Adds an EJB descriptor to the maps
+ *
+ * @param ejbDescriptor The EJB descriptor to add
+ */
public void add(EjbDescriptor<?> ejbDescriptor)
{
ejbsByName.put(ejbDescriptor.getEjbName(), ejbDescriptor);
ejbsByBeanClass.putIfAbsent(ejbDescriptor.getType(), new CopyOnWriteArraySet<EjbDescriptor<?>>());
ejbsByBeanClass.get(ejbDescriptor.getType()).add(ejbDescriptor);
}
-
+
+ /**
+ * Indicates if there are EJB descriptors available for an EJB name
+ *
+ * @param ejbName The EJB name to match
+ * @return True if present, otherwise false
+ */
public boolean containsKey(String ejbName)
{
return ejbsByName.containsKey(ejbName);
}
-
+
+ /**
+ * Indicates if there are EJB descriptors available for an EJB implementation
+ * class
+ *
+ * @param beanClass The class to match
+ * @return True if present, otherwise false
+ */
public boolean containsKey(Class<?> beanClass)
{
return ejbsByBeanClass.containsKey(beanClass);
}
-
+
+ /**
+ * Adds all EJB descriptors to the maps
+ *
+ * @param ejbDescriptors The descriptors to add
+ */
public void addAll(Iterable<EjbDescriptor<?>> ejbDescriptors)
{
for (EjbDescriptor<?> ejbDescriptor : ejbDescriptors)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSF.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSF.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/JSF.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
package org.jboss.webbeans.jsf;
import org.jboss.webbeans.util.ApiAbstraction;
@@ -2,7 +19,13 @@
+/**
+ * Utility class for JSF related components, concepts etc.
+ *
+ * @author Pete Muir
+ *
+ */
public class JSF extends ApiAbstraction
{
-
+ // An UI component
public static final Class<?> UICOMPONENT_CLASS = classForName("javax.faces.component.UIComponent");
-
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ApiAbstraction.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ApiAbstraction.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ApiAbstraction.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,19 +1,46 @@
package org.jboss.webbeans.util;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.lang.annotation.Annotation;
+/**
+ * A base class for utility classes that represent annotations, classes etc
+ *
+ * @author Pete Muir
+ */
public class ApiAbstraction
{
-
+
+ /**
+ * "Not found" annotation
+ */
public @interface DummyAnnotation
{
}
-
- public interface Dummy
+ /**
+ * "Not found" class
+ */
+ public interface Dummy
{
}
-
+
/**
* Initializes an annotation class
*
@@ -33,7 +60,14 @@
return DummyAnnotation.class;
}
}
-
+
+ /**
+ * Initializes a type
+ *
+ * @param name The name of the class
+ * @return The instance of the class. Returns a dummy if the class was not
+ * found.
+ */
@SuppressWarnings("unchecked")
protected static Class<?> classForName(String name)
{
@@ -46,7 +80,5 @@
return Dummy.class;
}
}
-
-
-
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
package org.jboss.webbeans.util;
import java.util.Map;
@@ -10,6 +27,11 @@
import com.google.common.collect.ForwardingMap;
+/**
+ * Represents a thread safe map
+ *
+ * @author Pete Muir
+ */
public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
{
@@ -102,12 +124,6 @@
{
return map;
}
-
- @Override
- public String toString()
- {
- return Strings.mapToString("ProxyPool (bean -> proxy): ", map);
- }
protected void rethrow(ExecutionException e)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
package org.jboss.webbeans.util;
import java.util.Enumeration;
@@ -3,14 +20,30 @@
import java.util.Iterator;
+/**
+ * An Enumeration -> Iteratble adaptor
+ *
+ * @author Pete Muir
+ * @see org.jboss.webbeans.util.EnumerationIterator
+ */
public class EnumerationIterable<T> implements Iterable<T>
{
-
+ // The enumeration-iteartor
private EnumerationIterator<T> iterator;
+ /**
+ * Constructor
+ *
+ * @param enumeration The enumeration
+ */
public EnumerationIterable(Enumeration<T> enumeration)
{
this.iterator = new EnumerationIterator<T>(enumeration);
}
+ /**
+ * Gets an iterator
+ *
+ * @return The iterator
+ */
public Iterator<T> iterator()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
package org.jboss.webbeans.util;
import java.util.Enumeration;
@@ -3,23 +20,47 @@
import java.util.Iterator;
+/**
+ * An enumeration -> iterator adapter
+ *
+ * @author Pete Muir
+ */
public class EnumerationIterator<T> implements Iterator<T>
{
+ // The enumeration
private Enumeration e;
+ /**
+ * Constructor
+ *
+ * @param e The enumeration
+ */
public EnumerationIterator(Enumeration e)
{
this.e = e;
}
+ /**
+ * Indicates if there are more items to iterate
+ *
+ * @return True if more, false otherwise
+ */
public boolean hasNext()
{
return e.hasMoreElements();
}
+ /**
+ * Gets the next item
+ *
+ * @return The next items
+ */
public T next()
{
return (T) e.nextElement();
}
+ /**
+ * Removes an item. Not supported
+ */
public void remove()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-16 18:56:04 UTC (rev 535)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-16 20:22:29 UTC (rev 536)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.
+ */
+
package org.jboss.webbeans.util;
import java.lang.annotation.Annotation;
More information about the weld-commits
mailing list