com.kenshoo.pl.entity.FinalEntityState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of persistence-layer Show documentation
Show all versions of persistence-layer Show documentation
A Java persistence layer based on JOOQ for high performance and business flow support.
package com.kenshoo.pl.entity;
import java.util.List;
public class FinalEntityState implements Entity {
private final CurrentEntityState currentState;
private final EntityChange extends EntityType>> change;
public FinalEntityState(CurrentEntityState currentState, EntityChange extends EntityType>> change) {
this.currentState = currentState;
this.change = change;
}
@Override
public boolean containsField(EntityField, ?> field) {
return change.containsField((EntityField)field) || currentState.containsField(field);
}
@Override
public T get(EntityField, T> field) {
return field.getEntityType() == change.getEntityType() && change.containsField((EntityField)field)
? (T)change.get((EntityField)field)
: currentState.get(field);
}
@Override
public > List> getMany(CHILD type) {
throw new UnsupportedOperationException("Final state of children is unknown at this point");
}
}