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

org.brightify.torch.EntityDescription Maven / Gradle / Ivy

The newest version!
package org.brightify.torch;

import org.brightify.torch.annotation.Entity;
import org.brightify.torch.filter.NumberProperty;
import org.brightify.torch.filter.Property;
import org.brightify.torch.util.Helper;
import org.brightify.torch.util.MigrationAssistant;

import java.util.Set;

/**
 * @author Tadeas Kriz
 */
public interface EntityDescription {
    /**
     * Returns the ID property.
     *
     * @return ID property of the target entity.
     */
    NumberProperty getIdProperty();

    /**
     * Returns an array of properties.
     *
     * @return An array of properties in the target entity.
     */
    Property[] getProperties();

    /**
     * Returns a safe class name.
     *
     * @see Helper#safeNameFromClass(Class) for meaning of the safety.
     *
     * @return Safe name of the entity.
     */
    String getSafeName();

    long getRevision();

    Entity.MigrationType getMigrationType();

    Long getEntityId(ENTITY entity);

    void setEntityId(ENTITY entity, Long id);

    Class getEntityClass();

    void setFromRawEntity(TorchFactory torchFactory, ReadableRawEntity rawEntity, ENTITY entity,
                            Set> loadGroups) throws Exception;

    ENTITY createEmpty();

    void toRawEntity(TorchFactory torchFactory, ENTITY entity, WritableRawEntity rawEntity) throws Exception;

    void migrate(MigrationAssistant assistant, long sourceRevision, long targetRevision) throws Exception;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy