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

io.rtr.alchemy.db.mongo.models.AllocationEntity Maven / Gradle / Ivy

The newest version!
package io.rtr.alchemy.db.mongo.models;

import dev.morphia.annotations.Entity;

import io.rtr.alchemy.models.Allocation;

/**
 * An entity that mirrors Allocation
 *
 * @see io.rtr.alchemy.models.Allocation
 */
@Entity
public class AllocationEntity {
    public String treatment;
    public int offset;
    public int size;

    // Required by Morphia
    @SuppressWarnings("unused")
    private AllocationEntity() {}

    private AllocationEntity(final Allocation allocation) {
        this.treatment = allocation.getTreatment().getName();
        this.offset = allocation.getOffset();
        this.size = allocation.getSize();
    }

    public static AllocationEntity from(final Allocation allocation) {
        return new AllocationEntity(allocation);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy