1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with this 4 * work for additional information regarding copyright ownership. The ASF 5 * licenses this file to You under the Apache License, Version 2.0 (the 6 * "License"); you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law 9 * or agreed to in writing, software distributed under the License is 10 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 11 * KIND, either express or implied. See the License for the specific language 12 * governing permissions and limitations under the License. 13 */ 14 package org.apache.webbeans.portable; 15 16 import java.lang.reflect.Field; 17 18 import javax.enterprise.inject.spi.AnnotatedField; 19 import javax.enterprise.inject.spi.AnnotatedType; 20 21 /** 22 * Implementation of {@link AnnotatedField} interface. 23 * 24 * @version $Rev: 788970 $ $Date: 2009-06-27 16:26:23 +0300 (Sat, 27 Jun 2009) $ 25 * 26 * @param <X> 27 */ 28 public class AnnotatedFieldImpl<X> extends AbstractAnnotatedMember<X> implements AnnotatedField<X> 29 { 30 31 /** 32 * Creates a new instance 33 * 34 * @param baseType base type 35 * @param javaMember field 36 */ 37 AnnotatedFieldImpl(Field javaMember) 38 { 39 this(javaMember, null); 40 } 41 42 /** 43 * Creates a new instance 44 * 45 * @param baseType base type 46 * @param javaMember field 47 */ 48 AnnotatedFieldImpl(Field javaMember, AnnotatedType<X> declaringType) 49 { 50 super(javaMember.getGenericType(), javaMember,declaringType); 51 52 setAnnotations(javaMember.getDeclaredAnnotations()); 53 } 54 55 56 /** 57 * {@inheritDoc} 58 */ 59 public Field getJavaMember() 60 { 61 return Field.class.cast(this.javaMember); 62 } 63 64 public String toString() 65 { 66 StringBuilder builder = new StringBuilder(); 67 builder.append("Annotated Field,"); 68 builder.append(super.toString()); 69 70 return builder.toString(); 71 } 72 73 }