mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
51 lines
979 B
Java
51 lines
979 B
Java
package com.avaje.ebeaninternal.server.deploy;
|
|
|
|
/**
|
|
* Holds multiple column unique constraints defined for an entity.
|
|
*/
|
|
public class CompoundUniqueConstraint {
|
|
|
|
private final String[] columns;
|
|
|
|
private final String name;
|
|
|
|
private final boolean unique;
|
|
|
|
public CompoundUniqueConstraint(String[] columns, String name, boolean unique) {
|
|
this.columns = columns;
|
|
this.unique = unique;
|
|
this.name = name;
|
|
}
|
|
|
|
/**
|
|
* Create a unique constraint given the column names.
|
|
*/
|
|
public CompoundUniqueConstraint(String[] columns) {
|
|
this.columns = columns;
|
|
this.unique = true;
|
|
this.name = null;
|
|
}
|
|
|
|
/**
|
|
* Return true if this is a unique constraint.
|
|
*/
|
|
public boolean isUnique() {
|
|
return unique;
|
|
}
|
|
|
|
/**
|
|
* Return the index name (can be null).
|
|
*/
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
/**
|
|
* Return the columns that make up this unique constraint.
|
|
*/
|
|
public String[] getColumns() {
|
|
return columns;
|
|
}
|
|
|
|
}
|