You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2012/01/18 10:38:25 UTC
[1/2] git commit: DELTASPIKE-45 reduced visibility of internal classes
Updated Branches:
refs/heads/master dac181b8e -> 427a51860
DELTASPIKE-45 reduced visibility of internal classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/427a5186
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/427a5186
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/427a5186
Branch: refs/heads/master
Commit: 427a518602fe4642ae213a19107295c3d1266492
Parents: dac181b
Author: gpetracek <gp...@apache.org>
Authored: Wed Jan 18 10:36:32 2012 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Wed Jan 18 10:36:32 2012 +0100
----------------------------------------------------------------------
.../core/api/metadata/AnnotatedCallableImpl.java | 87 ------
.../api/metadata/AnnotatedConstructorImpl.java | 64 ----
.../core/api/metadata/AnnotatedFieldImpl.java | 42 ---
.../core/api/metadata/AnnotatedImpl.java | 103 -------
.../core/api/metadata/AnnotatedMemberImpl.java | 62 ----
.../core/api/metadata/AnnotatedMethodImpl.java | 43 ---
.../core/api/metadata/AnnotatedParameterImpl.java | 58 ----
.../core/api/metadata/AnnotatedTypeImpl.java | 139 ---------
.../core/api/metadata/AnnotationRedefiner.java | 6 +-
.../core/api/metadata/AnnotationStore.java | 65 ----
.../deltaspike/core/api/metadata/Parameter.java | 232 ---------------
.../core/api/metadata/ParameterizedTypeImpl.java | 104 -------
.../core/api/metadata/RedefinitionContext.java | 5 +-
.../metadata/builder/AnnotatedCallableImpl.java | 85 ++++++
.../metadata/builder/AnnotatedConstructorImpl.java | 64 ++++
.../api/metadata/builder/AnnotatedFieldImpl.java | 42 +++
.../core/api/metadata/builder/AnnotatedImpl.java | 103 +++++++
.../api/metadata/builder/AnnotatedMemberImpl.java | 62 ++++
.../api/metadata/builder/AnnotatedMethodImpl.java | 43 +++
.../metadata/builder/AnnotatedParameterImpl.java | 58 ++++
.../api/metadata/builder/AnnotatedTypeBuilder.java | 9 +-
.../api/metadata/builder/AnnotatedTypeImpl.java | 138 +++++++++
.../api/metadata/builder/AnnotationBuilder.java | 1 -
.../core/api/metadata/builder/AnnotationStore.java | 65 ++++
.../core/api/metadata/builder/Parameter.java | 232 +++++++++++++++
.../core/api/util/HierarchyDiscovery.java | 2 -
.../core/api/util/ParameterizedTypeImpl.java | 104 +++++++
.../api/metadata/NamedAnnotationRedefiner.java | 4 +-
28 files changed, 1005 insertions(+), 1017 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedCallableImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedCallableImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedCallableImpl.java
deleted file mode 100644
index cd27c95..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedCallableImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import org.apache.deltaspike.core.api.metadata.builder.AnnotationBuilder;
-
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.AnnotatedType;
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-abstract class AnnotatedCallableImpl<X, Y extends Member> extends AnnotatedMemberImpl<X, Y>
- implements AnnotatedCallable<X>
-{
-
- private final List<AnnotatedParameter<X>> parameters;
-
- protected AnnotatedCallableImpl(AnnotatedType<X> declaringType, Y member, Class<?> memberType,
- Class<?>[] parameterTypes, Type[] genericTypes, AnnotationStore annotations,
- Map<Integer, AnnotationStore> parameterAnnotations, Type genericType,
- Map<Integer, Type> parameterTypeOverrides)
- {
- super(declaringType, member, memberType, annotations, genericType, null);
- this.parameters = getAnnotatedParameters(this, parameterTypes, genericTypes, parameterAnnotations,
- parameterTypeOverrides);
- }
-
- public List<AnnotatedParameter<X>> getParameters()
- {
- return Collections.unmodifiableList(parameters);
- }
-
- public AnnotatedParameter<X> getParameter(int index)
- {
- return parameters.get(index);
-
- }
-
- private static <X, Y extends Member> List<AnnotatedParameter<X>> getAnnotatedParameters(AnnotatedCallableImpl<X, Y> callable, Class<?>[] parameterTypes, Type[] genericTypes,
- Map<Integer, AnnotationStore> parameterAnnotations,
- Map<Integer, Type> parameterTypeOverrides)
- {
- List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>();
- int len = parameterTypes.length;
- for (int i = 0; i < len; ++i)
- {
- AnnotationBuilder builder = new AnnotationBuilder();
- if (parameterAnnotations != null && parameterAnnotations.containsKey(i))
- {
- builder.addAll(parameterAnnotations.get(i));
- }
- Type over = null;
- if (parameterTypeOverrides != null)
- {
- over = parameterTypeOverrides.get(i);
- }
- AnnotatedParameterImpl<X> p = new AnnotatedParameterImpl<X>(callable, parameterTypes[i], i, builder.create(), genericTypes[i], over);
- parameters.add(p);
- }
- return parameters;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedConstructorImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedConstructorImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedConstructorImpl.java
deleted file mode 100644
index 9cd1882..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedConstructorImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Type;
-import java.util.Map;
-
-/**
- * Implementation of {@link AnnotatedConstructor} to be used in {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}
- * and other CDI life cycle events.
- */
-class AnnotatedConstructorImpl<X> extends AnnotatedCallableImpl<X, Constructor<X>> implements AnnotatedConstructor<X>
-{
-
- /**
- * Constructor
- */
- public AnnotatedConstructorImpl(AnnotatedTypeImpl<X> type, Constructor<?> constructor, AnnotationStore annotations,
- Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> typeOverrides)
- {
-
- super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(), constructor.getParameterTypes(),
- getGenericArray(constructor), annotations, parameterAnnotations, null, typeOverrides);
- }
-
- private static Type[] getGenericArray(Constructor<?> constructor)
- {
- Type[] genericTypes = constructor.getGenericParameterTypes();
- // for inner classes genericTypes and parameterTypes can be different
- // length, this is a hack to fix this.
- // TODO: investigate this behavior further, on different JVM's and
- // compilers
- if (genericTypes.length + 1 == constructor.getParameterTypes().length)
- {
- genericTypes = new Type[constructor.getGenericParameterTypes().length + 1];
- genericTypes[0] = constructor.getParameterTypes()[0];
- for (int i = 0; i < constructor.getGenericParameterTypes().length; ++i)
- {
- genericTypes[i + 1] = constructor.getGenericParameterTypes()[i];
- }
- }
- return genericTypes;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedFieldImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedFieldImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedFieldImpl.java
deleted file mode 100644
index 708cad2..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedFieldImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedType;
-import java.lang.reflect.Field;
-import java.lang.reflect.Type;
-
-/**
- * Implementation of {@link AnnotatedField} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
- */
-class AnnotatedFieldImpl<X> extends AnnotatedMemberImpl<X, Field> implements AnnotatedField<X>
-{
-
- /**
- * Constructor.
- */
- public AnnotatedFieldImpl(AnnotatedType<X> declaringType, Field field, AnnotationStore annotations,
- Type overridenType)
- {
- super(declaringType, field, field.getType(), annotations, field.getGenericType(), overridenType);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedImpl.java
deleted file mode 100644
index ce9cf9c..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedImpl.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import org.apache.deltaspike.core.api.util.HierarchyDiscovery;
-
-import javax.enterprise.inject.spi.Annotated;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * The base class for all New Annotated types.
- */
-abstract class AnnotatedImpl implements Annotated
-{
-
- private final Type type;
- private final Set<Type> typeClosure;
- private final AnnotationStore annotations;
-
- protected AnnotatedImpl(Class<?> type, AnnotationStore annotations, Type genericType, Type overridenType)
- {
- if (overridenType == null)
- {
- if (genericType != null)
- {
- typeClosure = new HierarchyDiscovery(genericType).getTypeClosure();
- this.type = genericType;
- }
- else
- {
- typeClosure = new HierarchyDiscovery(type).getTypeClosure();
- this.type = type;
- }
- }
- else
- {
- this.type = overridenType;
- this.typeClosure = Collections.singleton(overridenType);
- }
-
-
- if (annotations == null)
- {
- this.annotations = new AnnotationStore();
- }
- else
- {
- this.annotations = annotations;
- }
- }
-
- @Override
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- return annotations.getAnnotation(annotationType);
- }
-
- @Override
- public Set<Annotation> getAnnotations()
- {
- return annotations.getAnnotations();
- }
-
- @Override
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return annotations.isAnnotationPresent(annotationType);
- }
-
- @Override
- public Set<Type> getTypeClosure()
- {
- return new HashSet<Type>(typeClosure);
- }
-
- @Override
- public Type getBaseType()
- {
- return type;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMemberImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMemberImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMemberImpl.java
deleted file mode 100644
index d0f1d19..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMemberImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import javax.enterprise.inject.spi.AnnotatedMember;
-import javax.enterprise.inject.spi.AnnotatedType;
-import java.lang.reflect.Member;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-
-/**
- * An implementation of {@link AnnotatedMember} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
- */
-abstract class AnnotatedMemberImpl<X, M extends Member> extends AnnotatedImpl implements AnnotatedMember<X>
-{
- private final AnnotatedType<X> declaringType;
- private final M javaMember;
-
- protected AnnotatedMemberImpl(AnnotatedType<X> declaringType, M member, Class<?> memberType,
- AnnotationStore annotations, Type genericType, Type overridenType)
- {
- super(memberType, annotations, genericType, overridenType);
- this.declaringType = declaringType;
- this.javaMember = member;
- }
-
- @Override
- public AnnotatedType<X> getDeclaringType()
- {
- return declaringType;
- }
-
- @Override
- public M getJavaMember()
- {
- return javaMember;
- }
-
- @Override
- public boolean isStatic()
- {
- return Modifier.isStatic(javaMember.getModifiers());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMethodImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMethodImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMethodImpl.java
deleted file mode 100644
index 9db15de..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedMethodImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Map;
-
-/**
- * Implementation of {@link AnnotatedMethod} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
- */
-class AnnotatedMethodImpl<X> extends AnnotatedCallableImpl<X, Method> implements AnnotatedMethod<X>
-{
- /**
- * Constructor.
- */
- public AnnotatedMethodImpl(AnnotatedType<X> type, Method method, AnnotationStore annotations,
- Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> parameterTypeOverrides)
- {
- super(type, method, method.getReturnType(), method.getParameterTypes(), method.getGenericParameterTypes(),
- annotations, parameterAnnotations, method.getGenericReturnType(), parameterTypeOverrides);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedParameterImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedParameterImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedParameterImpl.java
deleted file mode 100644
index 6f09d32..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedParameterImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import java.lang.reflect.Type;
-
-/**
- *
- */
-class AnnotatedParameterImpl<X> extends AnnotatedImpl implements AnnotatedParameter<X>
-{
-
- private final int position;
- private final AnnotatedCallable<X> declaringCallable;
-
- /**
- * Constructor
- */
- public AnnotatedParameterImpl(AnnotatedCallable<X> declaringCallable, Class<?> type, int position,
- AnnotationStore annotations, Type genericType, Type typeOverride)
- {
- super(type, annotations, genericType, typeOverride);
- this.declaringCallable = declaringCallable;
- this.position = position;
- }
-
- @Override
- public AnnotatedCallable<X> getDeclaringCallable()
- {
- return declaringCallable;
- }
-
- @Override
- public int getPosition()
- {
- return position;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedTypeImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedTypeImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedTypeImpl.java
deleted file mode 100644
index ba28de2..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotatedTypeImpl.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * An implementation of {@link AnnotatedType} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
- */
-public class AnnotatedTypeImpl<X> extends AnnotatedImpl implements AnnotatedType<X>
-{
-
- private final Set<AnnotatedConstructor<X>> constructors;
- private final Set<AnnotatedField<? super X>> fields;
- private final Set<AnnotatedMethod<? super X>> methods;
-
- private final Class<X> javaClass;
-
- /**
- * We make sure that there is a NewAnnotatedMember for every public
- * method/field/constructor
- * <p/>
- * If annotation have been added to other methods as well we add them to
- */
- public AnnotatedTypeImpl(Class<X> clazz, AnnotationStore typeAnnotations, Map<Field, AnnotationStore> fieldAnnotations, Map<Method, AnnotationStore> methodAnnotations,
- Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnotations, Map<Constructor<?>, AnnotationStore> constructorAnnotations,
- Map<Constructor<?>, Map<Integer, AnnotationStore>> constructorParameterAnnotations, Map<Field, Type> fieldTypes,
- Map<Method, Map<Integer, Type>> methodParameterTypes, Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes)
- {
- super(clazz, typeAnnotations, null, null);
- this.javaClass = clazz;
- this.constructors = new HashSet<AnnotatedConstructor<X>>();
- Set<Constructor<?>> cset = new HashSet<Constructor<?>>();
- Set<Method> mset = new HashSet<Method>();
- Set<Field> fset = new HashSet<Field>();
- for (Constructor<?> c : clazz.getConstructors())
- {
- AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(this, c, constructorAnnotations.get(c), constructorParameterAnnotations.get(c),
- constructorParameterTypes.get(c));
- constructors.add(nc);
- cset.add(c);
- }
- for (Map.Entry<Constructor<?>, AnnotationStore> c : constructorAnnotations.entrySet())
- {
- if (!cset.contains(c.getKey()))
- {
- AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(this, c.getKey(), c.getValue(), constructorParameterAnnotations.get(c.getKey()),
- constructorParameterTypes.get(c.getKey()));
- constructors.add(nc);
- }
- }
- this.methods = new HashSet<AnnotatedMethod<? super X>>();
- for (Method m : clazz.getMethods())
- {
- if (!m.getDeclaringClass().equals(Object.class))
- {
- AnnotatedMethodImpl<X> met = new AnnotatedMethodImpl<X>(this, m, methodAnnotations.get(m), methodParameterAnnotations.get(m), methodParameterTypes.get(m));
- methods.add(met);
- mset.add(m);
- }
- }
- for (Map.Entry<Method, AnnotationStore> c : methodAnnotations.entrySet())
- {
- if (!c.getKey().getDeclaringClass().equals(Object.class) && !mset.contains(c.getKey()))
- {
- AnnotatedMethodImpl<X> nc = new AnnotatedMethodImpl<X>(this, c.getKey(), c.getValue(), methodParameterAnnotations.get(c.getKey()),
- methodParameterTypes.get(c.getKey()));
- methods.add(nc);
- }
- }
- this.fields = new HashSet<AnnotatedField<? super X>>();
- for (Field f : clazz.getFields())
- {
- AnnotatedField<X> b = new AnnotatedFieldImpl<X>(this, f, fieldAnnotations.get(f), fieldTypes.get(f));
- fields.add(b);
- fset.add(f);
- }
- for (Map.Entry<Field, AnnotationStore> e : fieldAnnotations.entrySet())
- {
- if (!fset.contains(e.getKey()))
- {
- fields.add(new AnnotatedFieldImpl<X>(this, e.getKey(), e.getValue(), fieldTypes.get(e.getKey())));
- }
- }
- }
-
- @Override
- public Set<AnnotatedConstructor<X>> getConstructors()
- {
- return Collections.unmodifiableSet(constructors);
- }
-
- @Override
- public Set<AnnotatedField<? super X>> getFields()
- {
- return Collections.unmodifiableSet(fields);
- }
-
- @Override
- public Class<X> getJavaClass()
- {
- return javaClass;
- }
-
- @Override
- public Set<AnnotatedMethod<? super X>> getMethods()
- {
- return Collections.unmodifiableSet(methods);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationRedefiner.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationRedefiner.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationRedefiner.java
index c28a95f..1b9c02a 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationRedefiner.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationRedefiner.java
@@ -19,8 +19,6 @@
package org.apache.deltaspike.core.api.metadata;
-import java.lang.annotation.Annotation;
-
/**
* An implementation {@link AnnotationRedefiner} can be applied to an
* {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}, and receives callbacks for each annotation of
@@ -28,7 +26,7 @@ import java.lang.annotation.Annotation;
*
* @see org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder
*/
-public interface AnnotationRedefiner<A extends Annotation>
+public interface AnnotationRedefiner
{
/**
* Callback invoked for each annotation of the type the
@@ -36,6 +34,6 @@ public interface AnnotationRedefiner<A extends Annotation>
*
* @param ctx
*/
- public void redefine(RedefinitionContext<A> ctx);
+ public void redefine(RedefinitionContext ctx);
}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationStore.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationStore.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationStore.java
deleted file mode 100644
index 9594293..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/AnnotationStore.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.Set;
-
-import static java.util.Collections.emptyMap;
-import static java.util.Collections.emptySet;
-import static java.util.Collections.unmodifiableSet;
-
-/**
- * A helper class used to hold annotations on a type or member.
- */
-//X TODO: JavaDoc
-public class AnnotationStore
-{
- private final Map<Class<? extends Annotation>, Annotation> annotationMap;
- private final Set<Annotation> annotationSet;
-
- public AnnotationStore(Map<Class<? extends Annotation>, Annotation> annotationMap, Set<Annotation> annotationSet)
- {
- this.annotationMap = annotationMap;
- this.annotationSet = unmodifiableSet(annotationSet);
- }
-
- public AnnotationStore()
- {
- this.annotationMap = emptyMap();
- this.annotationSet = emptySet();
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- return annotationType.cast(annotationMap.get(annotationType));
- }
-
- public Set<Annotation> getAnnotations()
- {
- return annotationSet;
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return annotationMap.containsKey(annotationType);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/Parameter.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/Parameter.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/Parameter.java
deleted file mode 100644
index 661e151..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/Parameter.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import org.apache.deltaspike.core.api.util.Reflections;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-
-
-/**
- * An implementation of Member for parameters
- */
-abstract public class Parameter<X> implements AnnotatedElement
-{
-
- /**
- * Creates a new {@link Parameter} using the member and position passed in.
- *
- * @param declaringMember {@link Method} or {@link Constructor}.
- * @param position position of the parameter
- * @param <X> Type of the parameter
- * @return a new instance of Parameter
- */
- public static <X> Parameter<X> create(Member declaringMember, int position)
- {
- if (declaringMember instanceof Method)
- {
- return new MethodParameter<X>((Method) declaringMember, position);
- }
- else if (declaringMember instanceof Constructor<?>)
- {
- return new ConstructorParameter<X>(Reflections.<Constructor<X>>cast(declaringMember), position);
- }
- else
- {
- throw new IllegalArgumentException("Can only process members of type Method and Constructor, cannot process " + declaringMember);
- }
- }
-
- private static class MethodParameter<X> extends Parameter<X>
- {
-
- private final Method declaringMethod;
-
- private MethodParameter(Method declaringMethod, int position)
- {
- super(position);
- this.declaringMethod = declaringMethod;
- }
-
- @Override
- public Method getDeclaringMember()
- {
- return declaringMethod;
- }
-
- public Annotation[] getAnnotations()
- {
- if (declaringMethod.getParameterAnnotations().length > getPosition())
- {
- return declaringMethod.getParameterAnnotations()[getPosition()];
- }
- else
- {
- return Reflections.EMPTY_ANNOTATION_ARRAY;
- }
- }
-
- @Override
- public Type getBaseType()
- {
- if (declaringMethod.getGenericParameterTypes().length > getPosition())
- {
- return declaringMethod.getGenericParameterTypes()[getPosition()];
- }
- else
- {
- return declaringMethod.getParameterTypes()[getPosition()];
- }
- }
-
- }
-
- private static class ConstructorParameter<X> extends Parameter<X>
- {
-
- private final Constructor<X> declaringConstructor;
-
- private ConstructorParameter(Constructor<X> declaringConstructor, int position)
- {
- super(position);
- this.declaringConstructor = declaringConstructor;
- }
-
- @Override
- public Constructor<X> getDeclaringMember()
- {
- return declaringConstructor;
- }
-
- public Annotation[] getAnnotations()
- {
- if (declaringConstructor.getParameterAnnotations().length > getPosition())
- {
- return declaringConstructor.getParameterAnnotations()[getPosition()];
- }
- else
- {
- return Reflections.EMPTY_ANNOTATION_ARRAY;
- }
- }
-
- @Override
- public Type getBaseType()
- {
- if (declaringConstructor.getGenericParameterTypes().length > getPosition())
- {
- return declaringConstructor.getGenericParameterTypes()[getPosition()];
- }
- else
- {
- return declaringConstructor.getParameterTypes()[getPosition()];
- }
- }
-
- }
-
- private final int position;
-
- Parameter(int position)
- {
- this.position = position;
- }
-
- /**
- * Returns the actual {@link Member} declaring the parameter.
- *
- * @return Instance of the declaring java member.
- */
- public abstract Member getDeclaringMember();
-
- /**
- * Getter
- */
- public int getPosition()
- {
- return position;
- }
-
- @Override
- public int hashCode()
- {
- int hash = 1;
- hash = hash * 31 + getDeclaringMember().hashCode();
- hash = hash * 31 + Integer.valueOf(position).hashCode();
- return hash;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof Parameter<?>)
- {
- Parameter<?> that = (Parameter<?>) obj;
- return this.getDeclaringMember().equals(that.getDeclaringMember()) && this.getPosition() == that.getPosition();
- }
- else
- {
- return false;
- }
-
- }
-
- /**
- * Returns the instance of the annotation on the member, or null if not found
- */
- public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
- {
- for (Annotation annotation : getAnnotations())
- {
- if (annotation.annotationType().equals(annotationClass))
- {
- return annotationClass.cast(annotation);
- }
- }
- return null;
- }
-
- /**
- * Getter
- */
- public Annotation[] getDeclaredAnnotations()
- {
- return getAnnotations();
- }
-
- /**
- * Simple test if an annotation is present.
- */
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
- {
- return getAnnotation(annotationClass) != null;
- }
-
- /**
- * Getter
- */
- public abstract Type getBaseType();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/ParameterizedTypeImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/ParameterizedTypeImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/ParameterizedTypeImpl.java
deleted file mode 100644
index 445e54d..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/ParameterizedTypeImpl.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.deltaspike.core.api.metadata;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-/**
- * A basic implementation of {@link ParameterizedType}.
- */
-public class ParameterizedTypeImpl implements ParameterizedType
-{
- private final Type[] actualTypeArguments;
- private final Type rawType;
- private final Type ownerType;
-
- public ParameterizedTypeImpl(Type rawType, Type[] actualTypeArguments, Type ownerType)
- {
- this.actualTypeArguments = actualTypeArguments;
- this.rawType = rawType;
- this.ownerType = ownerType;
- }
-
- public Type[] getActualTypeArguments()
- {
- return Arrays.copyOf(actualTypeArguments, actualTypeArguments.length);
- }
-
- public Type getOwnerType()
- {
- return ownerType;
- }
-
- public Type getRawType()
- {
- return rawType;
- }
-
- @Override
- public int hashCode()
- {
- return Arrays.hashCode(actualTypeArguments) ^ (ownerType == null ? 0 : ownerType.hashCode()) ^ (rawType == null ? 0 : rawType.hashCode());
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- else if (obj instanceof ParameterizedType)
- {
- ParameterizedType that = (ParameterizedType) obj;
- Type thatOwnerType = that.getOwnerType();
- Type thatRawType = that.getRawType();
- return (ownerType == null ? thatOwnerType == null : ownerType.equals(thatOwnerType))
- && (rawType == null ? thatRawType == null : rawType.equals(thatRawType))
- && Arrays.equals(actualTypeArguments, that.getActualTypeArguments());
- }
- else
- {
- return false;
- }
-
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append(rawType);
- if (actualTypeArguments.length > 0)
- {
- sb.append("<");
- for (Type actualType : actualTypeArguments)
- {
- sb.append(actualType);
- sb.append(",");
- }
- sb.delete(sb.length() - 1, sb.length());
- sb.append(">");
- }
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/RedefinitionContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/RedefinitionContext.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/RedefinitionContext.java
index 98fb4f9..9d90a2a 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/RedefinitionContext.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/RedefinitionContext.java
@@ -22,7 +22,6 @@ package org.apache.deltaspike.core.api.metadata;
import org.apache.deltaspike.core.api.metadata.builder.AnnotationBuilder;
import org.apache.deltaspike.core.api.util.Reflections;
-import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Type;
@@ -32,7 +31,7 @@ import java.lang.reflect.Type;
* @see org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder
* @see AnnotationRedefiner
*/
-public class RedefinitionContext<A extends Annotation>
+public class RedefinitionContext
{
private final AnnotatedElement annotatedElement;
@@ -54,7 +53,7 @@ public class RedefinitionContext<A extends Annotation>
* {@link java.lang.reflect.Field}, if defined on a method, this may be cast to {@link java.lang.reflect.Method},
* if defined on a constructor, this may be cast to {@link java.lang.reflect.Constructor}, if
* defined on a class, this may be cast to {@link Class}, or if
- * defined on a parameter, this may be cast to {@link Parameter}
+ * defined on a parameter, this may be cast to {@link org.apache.deltaspike.core.api.metadata.builder.Parameter}
*/
public AnnotatedElement getAnnotatedElement()
{
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedCallableImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedCallableImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedCallableImpl.java
new file mode 100644
index 0000000..578bf95
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedCallableImpl.java
@@ -0,0 +1,85 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ */
+abstract class AnnotatedCallableImpl<X, Y extends Member> extends AnnotatedMemberImpl<X, Y>
+ implements AnnotatedCallable<X>
+{
+
+ private final List<AnnotatedParameter<X>> parameters;
+
+ protected AnnotatedCallableImpl(AnnotatedType<X> declaringType, Y member, Class<?> memberType,
+ Class<?>[] parameterTypes, Type[] genericTypes, AnnotationStore annotations,
+ Map<Integer, AnnotationStore> parameterAnnotations, Type genericType,
+ Map<Integer, Type> parameterTypeOverrides)
+ {
+ super(declaringType, member, memberType, annotations, genericType, null);
+ this.parameters = getAnnotatedParameters(this, parameterTypes, genericTypes, parameterAnnotations,
+ parameterTypeOverrides);
+ }
+
+ public List<AnnotatedParameter<X>> getParameters()
+ {
+ return Collections.unmodifiableList(parameters);
+ }
+
+ public AnnotatedParameter<X> getParameter(int index)
+ {
+ return parameters.get(index);
+
+ }
+
+ private static <X, Y extends Member> List<AnnotatedParameter<X>> getAnnotatedParameters(AnnotatedCallableImpl<X, Y> callable, Class<?>[] parameterTypes, Type[] genericTypes,
+ Map<Integer, AnnotationStore> parameterAnnotations,
+ Map<Integer, Type> parameterTypeOverrides)
+ {
+ List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>();
+ int len = parameterTypes.length;
+ for (int i = 0; i < len; ++i)
+ {
+ AnnotationBuilder builder = new AnnotationBuilder();
+ if (parameterAnnotations != null && parameterAnnotations.containsKey(i))
+ {
+ builder.addAll(parameterAnnotations.get(i));
+ }
+ Type over = null;
+ if (parameterTypeOverrides != null)
+ {
+ over = parameterTypeOverrides.get(i);
+ }
+ AnnotatedParameterImpl<X> p = new AnnotatedParameterImpl<X>(callable, parameterTypes[i], i, builder.create(), genericTypes[i], over);
+ parameters.add(p);
+ }
+ return parameters;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedConstructorImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedConstructorImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedConstructorImpl.java
new file mode 100644
index 0000000..24f49bd
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedConstructorImpl.java
@@ -0,0 +1,64 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+/**
+ * Implementation of {@link AnnotatedConstructor} to be used in {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}
+ * and other CDI life cycle events.
+ */
+class AnnotatedConstructorImpl<X> extends AnnotatedCallableImpl<X, Constructor<X>> implements AnnotatedConstructor<X>
+{
+
+ /**
+ * Constructor
+ */
+ public AnnotatedConstructorImpl(AnnotatedTypeImpl<X> type, Constructor<?> constructor, AnnotationStore annotations,
+ Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> typeOverrides)
+ {
+
+ super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(), constructor.getParameterTypes(),
+ getGenericArray(constructor), annotations, parameterAnnotations, null, typeOverrides);
+ }
+
+ private static Type[] getGenericArray(Constructor<?> constructor)
+ {
+ Type[] genericTypes = constructor.getGenericParameterTypes();
+ // for inner classes genericTypes and parameterTypes can be different
+ // length, this is a hack to fix this.
+ // TODO: investigate this behavior further, on different JVM's and
+ // compilers
+ if (genericTypes.length + 1 == constructor.getParameterTypes().length)
+ {
+ genericTypes = new Type[constructor.getGenericParameterTypes().length + 1];
+ genericTypes[0] = constructor.getParameterTypes()[0];
+ for (int i = 0; i < constructor.getGenericParameterTypes().length; ++i)
+ {
+ genericTypes[i + 1] = constructor.getGenericParameterTypes()[i];
+ }
+ }
+ return genericTypes;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedFieldImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedFieldImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedFieldImpl.java
new file mode 100644
index 0000000..5fe9f15
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedFieldImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+
+/**
+ * Implementation of {@link AnnotatedField} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
+ */
+class AnnotatedFieldImpl<X> extends AnnotatedMemberImpl<X, Field> implements AnnotatedField<X>
+{
+
+ /**
+ * Constructor.
+ */
+ public AnnotatedFieldImpl(AnnotatedType<X> declaringType, Field field, AnnotationStore annotations,
+ Type overridenType)
+ {
+ super(declaringType, field, field.getType(), annotations, field.getGenericType(), overridenType);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedImpl.java
new file mode 100644
index 0000000..d161835
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedImpl.java
@@ -0,0 +1,103 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import org.apache.deltaspike.core.api.util.HierarchyDiscovery;
+
+import javax.enterprise.inject.spi.Annotated;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * The base class for all New Annotated types.
+ */
+abstract class AnnotatedImpl implements Annotated
+{
+
+ private final Type type;
+ private final Set<Type> typeClosure;
+ private final AnnotationStore annotations;
+
+ protected AnnotatedImpl(Class<?> type, AnnotationStore annotations, Type genericType, Type overridenType)
+ {
+ if (overridenType == null)
+ {
+ if (genericType != null)
+ {
+ typeClosure = new HierarchyDiscovery(genericType).getTypeClosure();
+ this.type = genericType;
+ }
+ else
+ {
+ typeClosure = new HierarchyDiscovery(type).getTypeClosure();
+ this.type = type;
+ }
+ }
+ else
+ {
+ this.type = overridenType;
+ this.typeClosure = Collections.singleton(overridenType);
+ }
+
+
+ if (annotations == null)
+ {
+ this.annotations = new AnnotationStore();
+ }
+ else
+ {
+ this.annotations = annotations;
+ }
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ return annotations.getAnnotation(annotationType);
+ }
+
+ @Override
+ public Set<Annotation> getAnnotations()
+ {
+ return annotations.getAnnotations();
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return annotations.isAnnotationPresent(annotationType);
+ }
+
+ @Override
+ public Set<Type> getTypeClosure()
+ {
+ return new HashSet<Type>(typeClosure);
+ }
+
+ @Override
+ public Type getBaseType()
+ {
+ return type;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMemberImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMemberImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMemberImpl.java
new file mode 100644
index 0000000..886db5e
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMemberImpl.java
@@ -0,0 +1,62 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedType;
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+
+/**
+ * An implementation of {@link AnnotatedMember} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
+ */
+abstract class AnnotatedMemberImpl<X, M extends Member> extends AnnotatedImpl implements AnnotatedMember<X>
+{
+ private final AnnotatedType<X> declaringType;
+ private final M javaMember;
+
+ protected AnnotatedMemberImpl(AnnotatedType<X> declaringType, M member, Class<?> memberType,
+ AnnotationStore annotations, Type genericType, Type overridenType)
+ {
+ super(memberType, annotations, genericType, overridenType);
+ this.declaringType = declaringType;
+ this.javaMember = member;
+ }
+
+ @Override
+ public AnnotatedType<X> getDeclaringType()
+ {
+ return declaringType;
+ }
+
+ @Override
+ public M getJavaMember()
+ {
+ return javaMember;
+ }
+
+ @Override
+ public boolean isStatic()
+ {
+ return Modifier.isStatic(javaMember.getModifiers());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMethodImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMethodImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMethodImpl.java
new file mode 100644
index 0000000..3c9e156
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedMethodImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+/**
+ * Implementation of {@link AnnotatedMethod} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
+ */
+class AnnotatedMethodImpl<X> extends AnnotatedCallableImpl<X, Method> implements AnnotatedMethod<X>
+{
+ /**
+ * Constructor.
+ */
+ public AnnotatedMethodImpl(AnnotatedType<X> type, Method method, AnnotationStore annotations,
+ Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> parameterTypeOverrides)
+ {
+ super(type, method, method.getReturnType(), method.getParameterTypes(), method.getGenericParameterTypes(),
+ annotations, parameterAnnotations, method.getGenericReturnType(), parameterTypeOverrides);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedParameterImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedParameterImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedParameterImpl.java
new file mode 100644
index 0000000..c9682d2
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedParameterImpl.java
@@ -0,0 +1,58 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import java.lang.reflect.Type;
+
+/**
+ *
+ */
+class AnnotatedParameterImpl<X> extends AnnotatedImpl implements AnnotatedParameter<X>
+{
+
+ private final int position;
+ private final AnnotatedCallable<X> declaringCallable;
+
+ /**
+ * Constructor
+ */
+ public AnnotatedParameterImpl(AnnotatedCallable<X> declaringCallable, Class<?> type, int position,
+ AnnotationStore annotations, Type genericType, Type typeOverride)
+ {
+ super(type, annotations, genericType, typeOverride);
+ this.declaringCallable = declaringCallable;
+ this.position = position;
+ }
+
+ @Override
+ public AnnotatedCallable<X> getDeclaringCallable()
+ {
+ return declaringCallable;
+ }
+
+ @Override
+ public int getPosition()
+ {
+ return position;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeBuilder.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeBuilder.java
index c6b25ff..1df78fc 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeBuilder.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeBuilder.java
@@ -19,10 +19,7 @@
package org.apache.deltaspike.core.api.metadata.builder;
-import org.apache.deltaspike.core.api.metadata.AnnotatedTypeImpl;
import org.apache.deltaspike.core.api.metadata.AnnotationRedefiner;
-import org.apache.deltaspike.core.api.metadata.AnnotationStore;
-import org.apache.deltaspike.core.api.metadata.Parameter;
import org.apache.deltaspike.core.api.metadata.RedefinitionContext;
import org.apache.deltaspike.core.api.util.Reflections;
@@ -522,7 +519,7 @@ public class AnnotatedTypeBuilder<X>
* @throws IllegalArgumentException if the annotationType or redefinition is
* null
*/
- public <A extends Annotation> AnnotatedTypeBuilder<X> redefine(Class<A> annotationType, AnnotationRedefiner<A> redefinition)
+ public <A extends Annotation> AnnotatedTypeBuilder<X> redefine(Class<A> annotationType, AnnotationRedefiner redefinition)
{
if (annotationType == null)
{
@@ -571,13 +568,13 @@ public class AnnotatedTypeBuilder<X>
}
protected <A extends Annotation> void redefineAnnotationBuilder(Class<A> annotationType,
- AnnotationRedefiner<A> redefinition,
+ AnnotationRedefiner redefinition,
AnnotatedElement annotated, Type baseType,
AnnotationBuilder builder, String elementName)
{
if (builder.isAnnotationPresent(annotationType))
{
- redefinition.redefine(new RedefinitionContext<A>(annotated, baseType, builder, elementName));
+ redefinition.redefine(new RedefinitionContext(annotated, baseType, builder, elementName));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeImpl.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeImpl.java
new file mode 100644
index 0000000..1c908af
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeImpl.java
@@ -0,0 +1,138 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * An implementation of {@link AnnotatedType} to be used in CDI life cycle events and {@link org.apache.deltaspike.core.api.metadata.builder.AnnotatedTypeBuilder}.
+ */
+class AnnotatedTypeImpl<X> extends AnnotatedImpl implements AnnotatedType<X>
+{
+
+ private final Set<AnnotatedConstructor<X>> constructors;
+ private final Set<AnnotatedField<? super X>> fields;
+ private final Set<AnnotatedMethod<? super X>> methods;
+
+ private final Class<X> javaClass;
+
+ /**
+ * We make sure that there is a NewAnnotatedMember for every public
+ * method/field/constructor
+ * <p/>
+ * If annotation have been added to other methods as well we add them to
+ */
+ AnnotatedTypeImpl(Class<X> clazz, AnnotationStore typeAnnotations, Map<Field, AnnotationStore> fieldAnnotations, Map<Method, AnnotationStore> methodAnnotations,
+ Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnotations, Map<Constructor<?>, AnnotationStore> constructorAnnotations,
+ Map<Constructor<?>, Map<Integer, AnnotationStore>> constructorParameterAnnotations, Map<Field, Type> fieldTypes,
+ Map<Method, Map<Integer, Type>> methodParameterTypes, Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes)
+ {
+ super(clazz, typeAnnotations, null, null);
+ this.javaClass = clazz;
+ this.constructors = new HashSet<AnnotatedConstructor<X>>();
+ Set<Constructor<?>> cset = new HashSet<Constructor<?>>();
+ Set<Method> mset = new HashSet<Method>();
+ Set<Field> fset = new HashSet<Field>();
+ for (Constructor<?> c : clazz.getConstructors())
+ {
+ AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(this, c, constructorAnnotations.get(c), constructorParameterAnnotations.get(c),
+ constructorParameterTypes.get(c));
+ constructors.add(nc);
+ cset.add(c);
+ }
+ for (Map.Entry<Constructor<?>, AnnotationStore> c : constructorAnnotations.entrySet())
+ {
+ if (!cset.contains(c.getKey()))
+ {
+ AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(this, c.getKey(), c.getValue(), constructorParameterAnnotations.get(c.getKey()),
+ constructorParameterTypes.get(c.getKey()));
+ constructors.add(nc);
+ }
+ }
+ this.methods = new HashSet<AnnotatedMethod<? super X>>();
+ for (Method m : clazz.getMethods())
+ {
+ if (!m.getDeclaringClass().equals(Object.class))
+ {
+ AnnotatedMethodImpl<X> met = new AnnotatedMethodImpl<X>(this, m, methodAnnotations.get(m), methodParameterAnnotations.get(m), methodParameterTypes.get(m));
+ methods.add(met);
+ mset.add(m);
+ }
+ }
+ for (Map.Entry<Method, AnnotationStore> c : methodAnnotations.entrySet())
+ {
+ if (!c.getKey().getDeclaringClass().equals(Object.class) && !mset.contains(c.getKey()))
+ {
+ AnnotatedMethodImpl<X> nc = new AnnotatedMethodImpl<X>(this, c.getKey(), c.getValue(), methodParameterAnnotations.get(c.getKey()),
+ methodParameterTypes.get(c.getKey()));
+ methods.add(nc);
+ }
+ }
+ this.fields = new HashSet<AnnotatedField<? super X>>();
+ for (Field f : clazz.getFields())
+ {
+ AnnotatedField<X> b = new AnnotatedFieldImpl<X>(this, f, fieldAnnotations.get(f), fieldTypes.get(f));
+ fields.add(b);
+ fset.add(f);
+ }
+ for (Map.Entry<Field, AnnotationStore> e : fieldAnnotations.entrySet())
+ {
+ if (!fset.contains(e.getKey()))
+ {
+ fields.add(new AnnotatedFieldImpl<X>(this, e.getKey(), e.getValue(), fieldTypes.get(e.getKey())));
+ }
+ }
+ }
+
+ @Override
+ public Set<AnnotatedConstructor<X>> getConstructors()
+ {
+ return Collections.unmodifiableSet(constructors);
+ }
+
+ @Override
+ public Set<AnnotatedField<? super X>> getFields()
+ {
+ return Collections.unmodifiableSet(fields);
+ }
+
+ @Override
+ public Class<X> getJavaClass()
+ {
+ return javaClass;
+ }
+
+ @Override
+ public Set<AnnotatedMethod<? super X>> getMethods()
+ {
+ return Collections.unmodifiableSet(methods);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationBuilder.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationBuilder.java
index e708618..a0ca8d4 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationBuilder.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationBuilder.java
@@ -19,7 +19,6 @@
package org.apache.deltaspike.core.api.metadata.builder;
-import org.apache.deltaspike.core.api.metadata.AnnotationStore;
import org.apache.deltaspike.core.api.util.Reflections;
import java.lang.annotation.Annotation;
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationStore.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationStore.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationStore.java
new file mode 100644
index 0000000..1a6b7fb
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotationStore.java
@@ -0,0 +1,65 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import java.util.Set;
+
+import static java.util.Collections.emptyMap;
+import static java.util.Collections.emptySet;
+import static java.util.Collections.unmodifiableSet;
+
+/**
+ * A helper class used to hold annotations on a type or member.
+ */
+//X TODO: JavaDoc
+class AnnotationStore
+{
+ private final Map<Class<? extends Annotation>, Annotation> annotationMap;
+ private final Set<Annotation> annotationSet;
+
+ AnnotationStore(Map<Class<? extends Annotation>, Annotation> annotationMap, Set<Annotation> annotationSet)
+ {
+ this.annotationMap = annotationMap;
+ this.annotationSet = unmodifiableSet(annotationSet);
+ }
+
+ AnnotationStore()
+ {
+ this.annotationMap = emptyMap();
+ this.annotationSet = emptySet();
+ }
+
+ <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ return annotationType.cast(annotationMap.get(annotationType));
+ }
+
+ Set<Annotation> getAnnotations()
+ {
+ return annotationSet;
+ }
+
+ boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return annotationMap.containsKey(annotationType);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/427a5186/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/Parameter.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/Parameter.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/Parameter.java
new file mode 100644
index 0000000..8006c5d
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/Parameter.java
@@ -0,0 +1,232 @@
+/*
+ * 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.deltaspike.core.api.metadata.builder;
+
+import org.apache.deltaspike.core.api.util.Reflections;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+
+/**
+ * An implementation of Member for parameters
+ */
+abstract class Parameter<X> implements AnnotatedElement
+{
+
+ /**
+ * Creates a new {@link Parameter} using the member and position passed in.
+ *
+ * @param declaringMember {@link Method} or {@link Constructor}.
+ * @param position position of the parameter
+ * @param <X> Type of the parameter
+ * @return a new instance of Parameter
+ */
+ public static <X> Parameter<X> create(Member declaringMember, int position)
+ {
+ if (declaringMember instanceof Method)
+ {
+ return new MethodParameter<X>((Method) declaringMember, position);
+ }
+ else if (declaringMember instanceof Constructor<?>)
+ {
+ return new ConstructorParameter<X>(Reflections.<Constructor<X>>cast(declaringMember), position);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Can only process members of type Method and Constructor, cannot process " + declaringMember);
+ }
+ }
+
+ private static class MethodParameter<X> extends Parameter<X>
+ {
+
+ private final Method declaringMethod;
+
+ private MethodParameter(Method declaringMethod, int position)
+ {
+ super(position);
+ this.declaringMethod = declaringMethod;
+ }
+
+ @Override
+ public Method getDeclaringMember()
+ {
+ return declaringMethod;
+ }
+
+ public Annotation[] getAnnotations()
+ {
+ if (declaringMethod.getParameterAnnotations().length > getPosition())
+ {
+ return declaringMethod.getParameterAnnotations()[getPosition()];
+ }
+ else
+ {
+ return Reflections.EMPTY_ANNOTATION_ARRAY;
+ }
+ }
+
+ @Override
+ public Type getBaseType()
+ {
+ if (declaringMethod.getGenericParameterTypes().length > getPosition())
+ {
+ return declaringMethod.getGenericParameterTypes()[getPosition()];
+ }
+ else
+ {
+ return declaringMethod.getParameterTypes()[getPosition()];
+ }
+ }
+
+ }
+
+ private static class ConstructorParameter<X> extends Parameter<X>
+ {
+
+ private final Constructor<X> declaringConstructor;
+
+ private ConstructorParameter(Constructor<X> declaringConstructor, int position)
+ {
+ super(position);
+ this.declaringConstructor = declaringConstructor;
+ }
+
+ @Override
+ public Constructor<X> getDeclaringMember()
+ {
+ return declaringConstructor;
+ }
+
+ public Annotation[] getAnnotations()
+ {
+ if (declaringConstructor.getParameterAnnotations().length > getPosition())
+ {
+ return declaringConstructor.getParameterAnnotations()[getPosition()];
+ }
+ else
+ {
+ return Reflections.EMPTY_ANNOTATION_ARRAY;
+ }
+ }
+
+ @Override
+ public Type getBaseType()
+ {
+ if (declaringConstructor.getGenericParameterTypes().length > getPosition())
+ {
+ return declaringConstructor.getGenericParameterTypes()[getPosition()];
+ }
+ else
+ {
+ return declaringConstructor.getParameterTypes()[getPosition()];
+ }
+ }
+
+ }
+
+ private final int position;
+
+ Parameter(int position)
+ {
+ this.position = position;
+ }
+
+ /**
+ * Returns the actual {@link Member} declaring the parameter.
+ *
+ * @return Instance of the declaring java member.
+ */
+ public abstract Member getDeclaringMember();
+
+ /**
+ * Getter
+ */
+ public int getPosition()
+ {
+ return position;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 1;
+ hash = hash * 31 + getDeclaringMember().hashCode();
+ hash = hash * 31 + Integer.valueOf(position).hashCode();
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof Parameter<?>)
+ {
+ Parameter<?> that = (Parameter<?>) obj;
+ return this.getDeclaringMember().equals(that.getDeclaringMember()) && this.getPosition() == that.getPosition();
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ /**
+ * Returns the instance of the annotation on the member, or null if not found
+ */
+ public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+ {
+ for (Annotation annotation : getAnnotations())
+ {
+ if (annotation.annotationType().equals(annotationClass))
+ {
+ return annotationClass.cast(annotation);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Getter
+ */
+ public Annotation[] getDeclaredAnnotations()
+ {
+ return getAnnotations();
+ }
+
+ /**
+ * Simple test if an annotation is present.
+ */
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
+ {
+ return getAnnotation(annotationClass) != null;
+ }
+
+ /**
+ * Getter
+ */
+ public abstract Type getBaseType();
+
+}