Author: nickarls
Date: 2008-12-08 03:44:08 -0500 (Mon, 08 Dec 2008)
New Revision: 467
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
Log:
Moved MergedStereoTypes -> model, removed unused AnnotatedItemImpl
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-08
08:34:33 UTC (rev 466)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-08
08:44:08 UTC (rev 467)
@@ -46,6 +46,7 @@
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.model.MergedStereotypes;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-12-08
08:34:33 UTC (rev 466)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-12-08
08:44:08 UTC (rev 467)
@@ -1,171 +0,0 @@
-/*
- * 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.bean;
-
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.webbeans.MetaDataCache;
-import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
-import org.jboss.webbeans.model.StereotypeModel;
-import org.jboss.webbeans.util.Strings;
-
-/**
- * Meta model for the merged stereotype for a bean
- *
- * @author Pete Muir
- */
-public class MergedStereotypes<T, E>
-{
- // The possible deployment types
- private AnnotationMap possibleDeploymentTypes;
- // The possible scope types
- private Set<Annotation> possibleScopeTypes;
- // Is the bean name defaulted?
- private boolean beanNameDefaulted;
- // The required types
- private Set<Class<?>> requiredTypes;
- // The supported scopes
- private Set<Class<? extends Annotation>> supportedScopes;
-
- /**
- * Constructor
- *
- * @param stereotypeAnnotations The stereotypes to merge
- */
- public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
- {
- possibleDeploymentTypes = new AnnotationMap();
- possibleScopeTypes = new HashSet<Annotation>();
- requiredTypes = new HashSet<Class<?>>();
- supportedScopes = new HashSet<Class<? extends Annotation>>();
- merge(stereotypeAnnotations);
- }
-
- /**
- * Perform the merge
- *
- * @param stereotypeAnnotations The stereotype annotations
- */
- protected void merge(Set<Annotation> stereotypeAnnotations)
- {
- for (Annotation stereotypeAnnotation : stereotypeAnnotations)
- {
- // Retrieve and merge all metadata from stereotypes
- StereotypeModel<?> stereotype =
MetaDataCache.instance().getStereotype(stereotypeAnnotation.annotationType());
- if (stereotype == null)
- {
- throw new IllegalStateException("Stereotype " +
stereotypeAnnotation + " not registered with container");
- }
- if (stereotype.getDefaultDeploymentType() != null)
- {
-
possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(),
stereotype.getDefaultDeploymentType());
- }
- if (stereotype.getDefaultScopeType() != null)
- {
- possibleScopeTypes.add(stereotype.getDefaultScopeType());
- }
- requiredTypes.addAll(stereotype.getRequiredTypes());
- supportedScopes.addAll(stereotype.getSupportedScopes());
- if (stereotype.isBeanNameDefaulted())
- {
- beanNameDefaulted = true;
- }
- }
- }
-
- /**
- * Returns the possible deployment typess
- *
- * @return The deployment types
- */
- public AnnotationMap getPossibleDeploymentTypes()
- {
- return possibleDeploymentTypes;
- }
-
- /**
- * Returns the possible scope types
- *
- * @return The scope types
- */
- public Set<Annotation> getPossibleScopeTypes()
- {
- return possibleScopeTypes;
- }
-
- /**
- * Indicates if the name i defaulted
- *
- * @return True if defaulted, false if not
- */
- public boolean isBeanNameDefaulted()
- {
- return beanNameDefaulted;
- }
-
- /**
- * Returns the required types
- *
- * @return The required types
- */
- public Set<Class<?>> getRequiredTypes()
- {
- return requiredTypes;
- }
-
- /**
- * Returns the supported scopes
- *
- * @return The supported scopes
- */
- public Set<Class<? extends Annotation>> getSupportedScopes()
- {
- return supportedScopes;
- }
-
- /**
- * Indicates if the bean was declared in XML
- *
- * @return True if declared in XML, else false
- */
- public boolean isDeclaredInXml()
- {
- return false;
- }
-
- /**
- * Gets a string representation of the merged stereotypes
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Merged stereotypes:\n");
- buffer.append("Bean name defaulted: " + beanNameDefaulted +
"\n");
- buffer.append("Possible deployment types: " +
getPossibleDeploymentTypes().toString());
- buffer.append(Strings.collectionToString("Possible scope types: ",
getPossibleScopeTypes()));
- buffer.append(Strings.collectionToString("Required types: ",
getRequiredTypes()));
- buffer.append(Strings.collectionToString("Supported scopes: ",
getSupportedScopes()));
- return buffer.toString();
- }
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-12-08
08:34:33 UTC (rev 466)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-12-08
08:44:08 UTC (rev 467)
@@ -1,172 +0,0 @@
-/*
- * 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.introspector.jlr;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Strings;
-
-/**
- * Represents an annotated item
- *
- * This class is immutable, and therefore threadsafe
- *
- * @author Pete Muir
- *
- * @param <T>
- * @param <S>
- */
-public class AnnotatedItemImpl<T, S> extends AbstractAnnotatedItem<T, S>
-{
- // The actual type arguments
- private final Type[] actualTypeArguments;
- // The type of the item
- private final Class<T> type;
- // The actual annotations
- private final Annotation[] actualAnnotations;
-
- // Cached string representation
- private String toString;
-
- /**
- * Constructor
- *
- * @param annotations The annotations array of the type
- * @param type The type of the item
- * @param actualTypeArguments The actual type arguments array
- */
- public AnnotatedItemImpl(Annotation[] annotations, Class<T> type, Type[]
actualTypeArguments)
- {
- super(buildAnnotationMap(annotations));
- this.type = type;
- this.actualTypeArguments = actualTypeArguments;
- this.actualAnnotations = annotations;
- }
-
- /**
- * Gets the delegate (null)
- *
- * @return null
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getDelegate()
- */
- public S getDelegate()
- {
- return null;
- }
-
- /**
- * Gets the item type
- *
- * @return The type
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getType()
- */
- public Class<T> getType()
- {
- return type;
- }
-
- /**
- * Gets the actual type arguments
- *
- * @return The actual type arguments array
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getActualTypeArguments()
- */
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- /**
- * Gets the actual annotations
- *
- * @return The annotations array
- */
- public Annotation[] getActualAnnotations()
- {
- return actualAnnotations;
- }
-
- /**
- * Indicates if the item is static
- *
- * @return false
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#isStatic()
- */
- public boolean isStatic()
- {
- return false;
- }
-
- /**
- * Indicates if the item is final
- *
- * @return false
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#isFinal()
- */
- public boolean isFinal()
- {
- return false;
- }
-
- /**
- * Gets the name. Should be overridden
- *
- * @throws IllegalArgumentException.
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getName()
- */
- public String getName()
- {
- throw new IllegalArgumentException("Unable to determine name");
- }
-
- /**
- * Gets a string representation of the item
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- if (toString != null)
- {
- return toString;
- }
- toString = "Annotated item " +
Names.type2String(getDelegate().getClass());
- return toString;
- }
-
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedItemImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ",
Arrays.asList(getActualTypeArguments())));
- buffer.append(Strings.collectionToString("Actual annotations: ",
Arrays.asList(getActualAnnotations())));
- return buffer.toString();
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
(from rev 465,
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java 2008-12-08
08:44:08 UTC (rev 467)
@@ -0,0 +1,170 @@
+/*
+ * 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.model;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.MetaDataCache;
+import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
+import org.jboss.webbeans.util.Strings;
+
+/**
+ * Meta model for the merged stereotype for a bean
+ *
+ * @author Pete Muir
+ */
+public class MergedStereotypes<T, E>
+{
+ // The possible deployment types
+ private AnnotationMap possibleDeploymentTypes;
+ // The possible scope types
+ private Set<Annotation> possibleScopeTypes;
+ // Is the bean name defaulted?
+ private boolean beanNameDefaulted;
+ // The required types
+ private Set<Class<?>> requiredTypes;
+ // The supported scopes
+ private Set<Class<? extends Annotation>> supportedScopes;
+
+ /**
+ * Constructor
+ *
+ * @param stereotypeAnnotations The stereotypes to merge
+ */
+ public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
+ {
+ possibleDeploymentTypes = new AnnotationMap();
+ possibleScopeTypes = new HashSet<Annotation>();
+ requiredTypes = new HashSet<Class<?>>();
+ supportedScopes = new HashSet<Class<? extends Annotation>>();
+ merge(stereotypeAnnotations);
+ }
+
+ /**
+ * Perform the merge
+ *
+ * @param stereotypeAnnotations The stereotype annotations
+ */
+ protected void merge(Set<Annotation> stereotypeAnnotations)
+ {
+ for (Annotation stereotypeAnnotation : stereotypeAnnotations)
+ {
+ // Retrieve and merge all metadata from stereotypes
+ StereotypeModel<?> stereotype =
MetaDataCache.instance().getStereotype(stereotypeAnnotation.annotationType());
+ if (stereotype == null)
+ {
+ throw new IllegalStateException("Stereotype " +
stereotypeAnnotation + " not registered with container");
+ }
+ if (stereotype.getDefaultDeploymentType() != null)
+ {
+
possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(),
stereotype.getDefaultDeploymentType());
+ }
+ if (stereotype.getDefaultScopeType() != null)
+ {
+ possibleScopeTypes.add(stereotype.getDefaultScopeType());
+ }
+ requiredTypes.addAll(stereotype.getRequiredTypes());
+ supportedScopes.addAll(stereotype.getSupportedScopes());
+ if (stereotype.isBeanNameDefaulted())
+ {
+ beanNameDefaulted = true;
+ }
+ }
+ }
+
+ /**
+ * Returns the possible deployment typess
+ *
+ * @return The deployment types
+ */
+ public AnnotationMap getPossibleDeploymentTypes()
+ {
+ return possibleDeploymentTypes;
+ }
+
+ /**
+ * Returns the possible scope types
+ *
+ * @return The scope types
+ */
+ public Set<Annotation> getPossibleScopeTypes()
+ {
+ return possibleScopeTypes;
+ }
+
+ /**
+ * Indicates if the name i defaulted
+ *
+ * @return True if defaulted, false if not
+ */
+ public boolean isBeanNameDefaulted()
+ {
+ return beanNameDefaulted;
+ }
+
+ /**
+ * Returns the required types
+ *
+ * @return The required types
+ */
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ /**
+ * Returns the supported scopes
+ *
+ * @return The supported scopes
+ */
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+ /**
+ * Indicates if the bean was declared in XML
+ *
+ * @return True if declared in XML, else false
+ */
+ public boolean isDeclaredInXml()
+ {
+ return false;
+ }
+
+ /**
+ * Gets a string representation of the merged stereotypes
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Merged stereotypes:\n");
+ buffer.append("Bean name defaulted: " + beanNameDefaulted +
"\n");
+ buffer.append("Possible deployment types: " +
getPossibleDeploymentTypes().toString());
+ buffer.append(Strings.collectionToString("Possible scope types: ",
getPossibleScopeTypes()));
+ buffer.append(Strings.collectionToString("Required types: ",
getRequiredTypes()));
+ buffer.append(Strings.collectionToString("Supported scopes: ",
getSupportedScopes()));
+ return buffer.toString();
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+