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

net.yadaframework.core.YadaLocalEnum Maven / Gradle / Ivy

There is a newer version: 0.7.7.R4
Show newest version
package net.yadaframework.core;
import java.util.Locale;

import org.springframework.context.MessageSource;

import net.yadaframework.persistence.entity.YadaJobState;
import net.yadaframework.persistence.entity.YadaPersistentEnum;

/**
 * This interface must be applied to a normal enum that needs to be localized in order to perform sort and search operations
 * on the localized text.
 * Example:
 * 
 * public enum YadaJobState implements YadaLocalEnum {
 * }
 * 
* @param the enum * @see YadaPersistentEnum * @see YadaJobState */ public interface YadaLocalEnum> { /** * Return the associated YadaPersistentEnum to be used in entities * @return */ YadaPersistentEnum toYadaPersistentEnum(); /** * Used internally * @param yadaPersistentEnum */ void setYadaPersistentEnum(YadaPersistentEnum yadaPersistentEnum); /** * @return the database id for this enum value */ default public long toId() { return toYadaPersistentEnum().getId(); } /** * Convert the current enum to a localized string * @param messageSource * @param locale * @return */ String toString(MessageSource messageSource, Locale locale); // The following methods are implemented by enum: there's no need to implement them /** * Already implemented by enum * @return */ String name(); /** * Already implemented by enum * @return */ int ordinal(); /** * Already implemented by enum * @return */ Class getDeclaringClass(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy