#368 - ENH: Enhance @Index to support multiple columns, unique flag and hence also be able to put on the class (annotation target TYPE)

This commit is contained in:
Robin Bygrave committed 2015-08-28 21:56:38 +12:00
1 parent 641ada001e
commit ccba5d08ef
14 files changed
+152 -53

No files matched your search

@@ -0,0 +1,50 @@
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;
}
}