View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors. 
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   *
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.sequencer.java.metadata;
25  
26  import java.util.ArrayList;
27  import java.util.LinkedList;
28  import java.util.List;
29  
30  /**
31   * FieldMetadata is the base class of all fields.
32   */
33  public class FieldMetadata {
34  
35      /** The type of the field */
36      private String type;
37  
38      private String name;
39  
40      /** The variables */
41      private List<Variable> variables = new ArrayList<Variable>();
42  
43      private List<ModifierMetadata> modifierMetadatas = new ArrayList<ModifierMetadata>();
44  
45      private List<AnnotationMetadata> annotations = new LinkedList<AnnotationMetadata>();
46      
47      
48      public List<AnnotationMetadata> getAnnotations() {
49          return annotations;
50      }
51  
52      /**
53       * @return variables
54       */
55      public List<Variable> getVariables() {
56          return variables;
57      }
58  
59      /**
60       * @param variables Sets variables to the specified value.
61       */
62      public void setVariables( List<Variable> variables ) {
63          this.variables = variables;
64      }
65  
66      /**
67       * @return type
68       */
69      public String getType() {
70          return type;
71      }
72  
73      /**
74       * @param type Sets type to the specified value.
75       */
76      public void setType( String type ) {
77          this.type = type;
78      }
79  
80      /**
81       * @return the name of the field
82       */
83      public String getName() {
84          return name;
85      }
86  
87      /**
88       * @param name the new name for the field
89       */
90      public void setName( String name ) {
91          this.name = name;
92      }
93  
94      /**
95       * @return modifierMetadatas
96       */
97      public List<ModifierMetadata> getModifiers() {
98          return modifierMetadatas;
99      }
100 
101     /**
102      * @param modifierMetadatas Sets modifierMetadatas to the specified value.
103      */
104     public void setModifiers( List<ModifierMetadata> modifierMetadatas ) {
105         this.modifierMetadatas = modifierMetadatas;
106     }
107 
108     /**
109      * @param modifierName the name of the modifier to check for
110      * @return true if the type has a modifier of that name, otherwise false
111      */
112     public boolean hasModifierNamed( String modifierName ) {
113         for (ModifierMetadata modifier : modifierMetadatas) {
114             if (modifierName.equals(modifier.getName())) {
115                 return true;
116             }
117         }
118 
119         return false;
120 
121     }
122 
123     /**
124      * Find out if a field is primitive type or not.
125      * 
126      * @return true if field is a primitive type.
127      */
128     public boolean isPrimitiveType() {
129         return false;
130     }
131 
132     /**
133      * Find out if a field is a simple type or not.
134      * 
135      * @return true if field is a simple type.
136      */
137     public boolean isSimpleType() {
138         return false;
139     }
140 
141     /**
142      * Find out if a field is a array type or not.
143      * 
144      * @return true if field is a array type.
145      */
146     public boolean isArrayType() {
147         return false;
148     }
149 
150     /**
151      * Find out if a field is a qualified type or not.
152      * 
153      * @return true if field is a qualified type.
154      */
155     public boolean isQualifiedType() {
156         return false;
157     }
158 
159     /**
160      * Find out if a field is a parameterized type or not.
161      * 
162      * @return true if field is a parameterized type.
163      */
164     public boolean isParameterizedType() {
165         return false;
166     }
167 
168     /**
169      * Find out if a field is a wild card type or not.
170      * 
171      * @return true if field is a wild card type.
172      */
173     public boolean isWildcardType() {
174         return false;
175     }
176 }