com.distelli.persistence.UpdateItemBuilder Maven / Gradle / Ivy
package com.distelli.persistence;
import javax.persistence.RollbackException;
/**
* NOTE: the valueType is the type of the value parameter, NOT necessary the type
* of the attribute. More specifically, the setAdd/setRemove should always have a
* valueType of STR, NUM, or BIN.
*/
public interface UpdateItemBuilder {
// BASIC:
public UpdateItemBuilder remove(String attrName);
public UpdateItemBuilder copy(String dstAttrName, String srcAttrName);
public UpdateItemBuilder set(String attrName, AttrType valueType, V value);
public UpdateItemBuilder setIfNotExists(String attrName, AttrType valueType, V value);
// LIST UPDATES:
public UpdateItemBuilder listRemove(String attrName, int index);
public UpdateItemBuilder listAdd(String attrName, AttrType valueType, V value);
public UpdateItemBuilder listSet(String attrName, int index, AttrType valueType, V value);
// MAP UPDATES:
public UpdateItemBuilder mapRemove(String attrName, String key);
public UpdateItemBuilder mapPut(String attrName, String key, AttrType valueType, V value);
// SET UPDATES:
public UpdateItemBuilder setRemove(String attrName, AttrType valueType, V value);
public UpdateItemBuilder setAdd(String attrName, AttrType valueType, V value);
// NUMBER UPDATES:
public UpdateItemBuilder increment(String attrName, Number amount);
// WHAT SHOULD BE RETURNED (if not specified, null is returned)?
public UpdateItemBuilder returnAllNew();
public UpdateItemBuilder returnUpdatedNew();
// CONDITIONAL:
public T when(FilterCondFn filterCondFn) throws RollbackException;
public V when(FilterCondFn filterCondFn, Class mapType) throws RollbackException;
// NO CONDITIONAL:
public T always();
public V always(Class mapType);
// Deprecated APIs (these APIs do NOT go through the ConvertValue and therefore
// may be "dangerous" if a type conversion is needed):
@Deprecated
public UpdateItemBuilder set(String attrName, V value);
@Deprecated
public UpdateItemBuilder setIfNotExists(String attrName, V value);
@Deprecated
public UpdateItemBuilder listAdd(String attrName, V value);
@Deprecated
public UpdateItemBuilder listSet(String attrName, int index, V value);
@Deprecated
public UpdateItemBuilder mapPut(String attrName, String key, V value);
@Deprecated
public UpdateItemBuilder setRemove(String attrName, V value);
@Deprecated
public UpdateItemBuilder setAdd(String attrName, V value);
}