
com.venky.swf.db.model.reflection.uniquekey.UniqueKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swf-db Show documentation
Show all versions of swf-db Show documentation
Succinct Web Framework - Db
The newest version!
package com.venky.swf.db.model.reflection.uniquekey;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.venky.core.collections.SequenceMap;
import com.venky.swf.db.model.Model;
import com.venky.swf.db.model.reflection.ModelReflector;
public class UniqueKey {
public UniqueKey(Class modelClass,String keyName){
this.modelClass = modelClass;
this.keyName = keyName;
}
private final Class modelClass;
public Class getModelClass() {
return this.modelClass;
}
private final String keyName ;
public String getKeyName() {
return this.keyName;
}
public ModelReflector getReflector() {
return ModelReflector.instance(modelClass);
}
private Map> fields = new SequenceMap<>();
public void addField(String field, boolean exportable, boolean allowMultipleRecordsWithNull) {
UniqueKeyFieldDescriptor ukfd = new UniqueKeyFieldDescriptor(this,field);
ukfd.setMultipleRecordsWithNullAllowed(allowMultipleRecordsWithNull);
ukfd.setExportable(exportable);
this.fields.put(field, ukfd);
}
public UniqueKeyFieldDescriptor getDescriptor(String field) {
return this.fields.get(field);
}
public int size(){
return fields.size();
}
public Collection> getFields(){
return fields.values();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy