View Javadoc
1   /*
2    * Copyright (C) 2016 uwe
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16   */
17  package org.sw4j.tool.annotation.jpa.generator.model;
18  
19  import javax.annotation.Nonnull;
20  import javax.xml.bind.annotation.XmlAccessType;
21  import javax.xml.bind.annotation.XmlAccessorType;
22  import javax.xml.bind.annotation.XmlAttribute;
23  
24  /**
25   * This class represents a table. The table is assigned to an entity and you can access the columns assigned to this
26   * table.
27   *
28   * @author Uwe Plonus
29   */
30  @XmlAccessorType(XmlAccessType.NONE)
31  public class Table {
32  
33      /** The name of the table. */
34      private final String name;
35  
36      /** The catalog of the table. */
37      private final String catalog;
38  
39      /** The schema of the table. */
40      private final String schema;
41  
42      /** The entity this table belongs to. */
43      private final Entity entity;
44  
45      /**
46       * Constructor for a table.
47       *
48       * @param name the name of the table.
49       * @param catalog the catalog of the table.
50       * @param schema the schema of the table.
51       * @param entity the entity the table belongs to.
52       */
53      public Table(@Nonnull final String name, @Nonnull final String catalog, @Nonnull final String schema,
54              @Nonnull final Entity entity) {
55          this.name = name;
56          this.catalog = catalog;
57          this.schema = schema;
58          this.entity = entity;
59      }
60  
61      /**
62       * Returns the name of the table.
63       *
64       * @return the name.
65       */
66      @Nonnull
67      @XmlAttribute(name = "name", required = true)
68      public String getName() {
69          return name;
70      }
71  
72      /**
73       * Returns the catalog of the table.
74       *
75       * @return the catalog.
76       */
77      @Nonnull
78      @XmlAttribute(name = "catalog", required = false)
79      public String getCatalog() {
80          return catalog;
81      }
82  
83      /**
84       * Returns the schema of the table.
85       *
86       * @return the schema.
87       */
88      @Nonnull
89      @XmlAttribute(name = "schema", required = false)
90      public String getSchema() {
91          return schema;
92      }
93  
94      /**
95       * Returns the entity of the table.
96       *
97       * @return the entity.
98       */
99      @Nonnull
100     public Entity getEntity() {
101         return entity;
102     }
103 
104 }