View Javadoc

1   package com.lexicalscope.fluentreflection;
2   
3   import java.lang.annotation.Annotation;
4   import java.lang.reflect.AnnotatedElement;
5   
6   import org.hamcrest.Matcher;
7   
8   /*
9    * Copyright 2011 Tim Wood
10   *
11   * Licensed under the Apache License, Version 2.0 (the "License");
12   * you may not use this file except in compliance with the License.
13   * You may obtain a copy of the License at
14   *
15   * http://www.apache.org/licenses/LICENSE-2.0
16   *
17   * Unless required by applicable law or agreed to in writing, software
18   * distributed under the License is distributed on an "AS IS" BASIS,
19   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   * See the License for the specific language governing permissions and
21   * limitations under the License.
22   */
23  
24  abstract class AbstractFluentAnnotated implements FluentAnnotated {
25      private final FluentAnnotated annotatedElement;
26  
27      public AbstractFluentAnnotated(
28              final ReflectedTypeFactory reflectedTypeFactory,
29              final AnnotatedElement annotatedElement) {
30          this.annotatedElement = new FluentAnnotatedImpl(reflectedTypeFactory, annotatedElement);
31      }
32  
33      @Override public FluentClass<?> annotation(final Matcher<? super FluentClass<?>> annotationMatcher) {
34          return annotatedElement.annotation(annotationMatcher);
35      }
36  
37      @Override public boolean annotatedWith(final Class<? extends Annotation> annotationClass) {
38          return annotatedElement.annotatedWith(annotationClass);
39      }
40  
41      @Override public boolean annotatedWith(final Matcher<? super FluentClass<?>> annotationMatcher) {
42          return annotatedElement.annotatedWith(annotationMatcher);
43      }
44  
45      @Override public <A extends Annotation> A annotation(final Class<A> annotationClass) {
46          return annotatedElement.annotation(annotationClass);
47      }
48  }