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

net.nemerosa.ontrack.model.structure.Entity Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.structure;

import static org.apache.commons.lang3.Validate.isTrue;

/**
 * An Entity is a model object that has an {@link ID}. The state of this ID will determined the status
 * of this entity:
 * 
    *
  • new - the ID is not {@linkplain ID#isSet() set}.
  • *
  • defined - the ID is {@linkplain ID#isSet() set}.
  • *
*/ public interface Entity { public static void isEntityNew(Entity e, String message) { isTrue(e != null && !ID.isDefined(e.getId()), message); } public static void isEntityDefined(Entity e, String message) { isTrue(e != null && ID.isDefined(e.getId()), message); } ID getId(); default int id() { ID id = getId(); isTrue(ID.isDefined(id), "ID must be defined"); return id.getValue(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy