blob: 5dc7209dab1b74e876c5e0e35c123b36b345d6e1 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2013 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0, which accompanies this distribution
* and is available at https://www.eclipse.org/legal/epl-2.0/.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.Vector;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.jpa.core.context.JpaContextModel;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
public abstract class AbstractOrmUniqueConstraint<P extends JpaContextModel>
extends AbstractOrmXmlContextModel<P>
implements UniqueConstraint
{
protected final Vector<String> columnNames = new Vector<String>();
public AbstractOrmUniqueConstraint(P parent) {
super(parent);
}
// ********** column names **********
public Iterable<String> getColumnNames() {
return IterableTools.cloneLive(this.columnNames);
}
public int getColumnNamesSize() {
return this.columnNames.size();
}
public String getColumnName(int index) {
return this.columnNames.get(index);
}
protected void syncColumnNames() {
this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST);
}
protected abstract Iterable<String> getResourceColumnNames();
@Override
public void toString(StringBuilder sb) {
sb.append(this.columnNames);
}
}