Class LuteceCacheLiteral
java.lang.Object
jakarta.enterprise.util.AnnotationLiteral<LuteceCache>
fr.paris.lutece.portal.service.cache.LuteceCacheLiteral
- All Implemented Interfaces:
Annotation
public class LuteceCacheLiteral
extends jakarta.enterprise.util.AnnotationLiteral<LuteceCache>
implements LuteceCache
The
LuteceCacheLiteral class is an implementation of the LuteceCache annotation
that is used in the context of dependency injection frameworks. This class provides a way to create
literal instances of the LuteceCache annotation which can be used for various purposes
such as programmatic configuration or injection in a framework that requires annotation literals.
This class extends AnnotationLiteral<LuteceCache> and implements the LuteceCache
interface, allowing it to serve as a concrete representation of the LuteceCache annotation.
Constructor:
LuteceCacheLiteral(String cacheName, Class<?> keyType, Class<?> valueType, boolean enable)
Parameters:
cacheName: The name of the cache to be used. This is a required parameter.keyType: The class type of the cache keys. Defaults toObject.classif not specified.valueType: The class type of the cache values. Defaults toObject.classif not specified.enable: A boolean flag indicating whether the cache injection should be enabled. Defaults tofalse.
Methods:
cacheName(): Returns the name of the cache.keyType(): Returns the class type of the cache keys.valueType(): Returns the class type of the cache values.enable(): Returns whether the cache injection is enabled.
Example usage:
LuteceCacheLiteral literal = new LuteceCacheLiteral("myCache", Integer.class, String.class, true);
String cacheName = literal.cacheName(); // "myCache"
Class<?> keyType = literal.keyType(); // Integer.class
Class<?> valueType = literal.valueType(); // String.class
boolean isEnabled = literal.enable(); // true
This class is typically used in environments where annotations need to be programmatically created and used, such as in custom CDI (Contexts and Dependency Injection) implementations or configuration setups.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLuteceCacheLiteral(String cacheName, Class<?> keyType, Class<?> valueType, boolean enable, boolean preventGlobalReset) Constructs a newLuteceCacheLiteralwith the specified parameters.LuteceCacheLiteral(String cacheName, Class<?> keyType, Class<?> valueType, boolean enable, boolean preventGlobalReset, boolean required, boolean preventReset) Constructs a newLuteceCacheLiteralof a cache the webapp cannot run without. -
Method Summary
Methods inherited from class jakarta.enterprise.util.AnnotationLiteral
annotationType, equals, hashCode, toString
-
Constructor Details
-
LuteceCacheLiteral
public LuteceCacheLiteral(String cacheName, Class<?> keyType, Class<?> valueType, boolean enable, boolean preventGlobalReset) Constructs a newLuteceCacheLiteralwith the specified parameters.- Parameters:
cacheName- the name of the cachekeyType- the class type of the cache keysvalueType- the class type of the cache valuesenable- whether cache injection is enabledpreventGlobalReset- whether the cache can be reset by global resets
-
LuteceCacheLiteral
public LuteceCacheLiteral(String cacheName, Class<?> keyType, Class<?> valueType, boolean enable, boolean preventGlobalReset, boolean required, boolean preventReset) Constructs a newLuteceCacheLiteralof a cache the webapp cannot run without.- Parameters:
cacheName- the name of the cachekeyType- the class type of the cache keysvalueType- the class type of the cache valuesenable- whether cache injection is enabledpreventGlobalReset- whether the cache can be reset by global resetsrequired- whether the cache is always enabledpreventReset- whether every reset of the cache is prevented
-
-
Method Details
-
cacheName
-
keyType
-
valueType
-
enable
public boolean enable() -
preventGlobalReset
public boolean preventGlobalReset() -
required
public boolean required() -
preventReset
public boolean preventReset()
-