All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kenshoo.pl.entity.FinalEntityState Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.entity;

import java.util.List;

public class FinalEntityState implements Entity {

    private final CurrentEntityState currentState;
    private final EntityChange> change;

    public FinalEntityState(CurrentEntityState currentState, EntityChange> 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 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");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy