View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.flatfile.dsl;
18  
19  import java.util.Collection;
20  import java.util.Collections;
21  
22  import antlr.collections.AST;
23  
24  /**
25   * Entity definition.
26   * @version $Revision: 758023 $ $Date: 2009-03-24 16:09:19 -0500 (Tue, 24 Mar 2009) $
27   */
28  public class EntityDefinition {
29      private String name;
30      private AST ast;
31      private Collection<AST> checks;
32  
33      /**
34       * Create a new EntityDefinition.
35       * @param name of this Entity
36       * @param ast AST holding the parsed Entity
37       */
38      public EntityDefinition(String name, AST ast) {
39          this.name = name;
40          this.ast = ast;
41      }
42  
43      /**
44       * Get the ast.
45       * @return AST.
46       */
47      public AST getAst() {
48          return ast;
49      }
50  
51      /**
52       * Get the name.
53       * @return String.
54       */
55      public String getName() {
56          return name;
57      }
58  
59      /**
60       * Get the checks.
61       * @return Collection.
62       */
63      public synchronized Collection<AST> getChecks() {
64          return checks == null ? Collections.<AST>emptyList() : checks;
65      }
66  
67      /**
68       * Set the checks.
69       * @param checks The Collection checks to set.
70       */
71      public synchronized void setChecks(Collection<AST> checks) {
72          this.checks = checks;
73      }
74  }