
org.batoo.jpa.parser.impl.metadata.TableMetadataImpl Maven / Gradle / Ivy
/*
* Copyright (c) 2012 - Batoo Software ve Consultancy Ltd.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.batoo.jpa.parser.impl.metadata;
import java.util.List;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.batoo.jpa.parser.impl.AbstractLocator;
import org.batoo.jpa.parser.metadata.TableMetadata;
import org.batoo.jpa.parser.metadata.UniqueConstraintMetadata;
import com.google.common.collect.Lists;
/**
* Implementation of {@link TableMetadata}.
*
* @author hceylan
* @since $version
*/
public class TableMetadataImpl implements TableMetadata {
private final AbstractLocator locator;
private final String catalog;
private final String schema;
private final String name;
private final List uniqueConstraints = Lists.newArrayList();
/**
* @param locator
* the java locator
* @param annotation
* the annotation
*
* @since $version
* @author hceylan
*/
public TableMetadataImpl(AbstractLocator locator, Table annotation) {
super();
this.locator = locator;
this.catalog = annotation.catalog();
this.schema = annotation.schema();
this.name = annotation.name();
for (final UniqueConstraint constraint : annotation.uniqueConstraints()) {
this.uniqueConstraints.add(new UniqueConstraintMetadataImpl(locator, constraint));
}
}
/**
* {@inheritDoc}
*
*/
@Override
public String getCatalog() {
return this.catalog;
}
/**
* {@inheritDoc}
*
*/
@Override
public AbstractLocator getLocator() {
return this.locator;
}
/**
* {@inheritDoc}
*
*/
@Override
public String getName() {
return this.name;
}
/**
* {@inheritDoc}
*
*/
@Override
public String getSchema() {
return this.schema;
}
/**
* {@inheritDoc}
*
*/
@Override
public List getUniqueConstraints() {
return this.uniqueConstraints;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy