001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.flatfile.dsl;
018
019import java.util.Collection;
020import java.util.Collections;
021
022import antlr.collections.AST;
023
024/**
025 * Entity definition.
026 * @version $Revision: 758023 $ $Date: 2009-03-24 16:09:19 -0500 (Tue, 24 Mar 2009) $
027 */
028public class EntityDefinition {
029    private String name;
030    private AST ast;
031    private Collection<AST> checks;
032
033    /**
034     * Create a new EntityDefinition.
035     * @param name of this Entity
036     * @param ast AST holding the parsed Entity
037     */
038    public EntityDefinition(String name, AST ast) {
039        this.name = name;
040        this.ast = ast;
041    }
042
043    /**
044     * Get the ast.
045     * @return AST.
046     */
047    public AST getAst() {
048        return ast;
049    }
050
051    /**
052     * Get the name.
053     * @return String.
054     */
055    public String getName() {
056        return name;
057    }
058
059    /**
060     * Get the checks.
061     * @return Collection.
062     */
063    public synchronized Collection<AST> getChecks() {
064        return checks == null ? Collections.<AST>emptyList() : checks;
065    }
066
067    /**
068     * Set the checks.
069     * @param checks The Collection checks to set.
070     */
071    public synchronized void setChecks(Collection<AST> checks) {
072        this.checks = checks;
073    }
074}