Interface MessagesMapService
-
- All Known Implementing Classes:
DefaultMessagesMapService
public interface MessagesMapServiceProvides a messages map factory service for the Click runtime.Configuration
The defaultMessagesMapServiceimplementation isDefaultMessagesMapService. You can instruct Click to use a different implementation by adding the following element to your click.xml configuration file.<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <click-app charset="UTF-8"> <pages package="org.apache.click.examples.page"/> <messages-map-service classname="com.mycorp.CustomMessagesMapService"/> </click-app>The class com.mycorp.CustomMessagesMapService might be defined as follows:package com.mycorp; public class CustomMessagesMapService implements MessagesMapService { public MapcreateMessagesMap(Class<?> baseClass, String globalResource, Locale locale) { return new MyMessagesMap(baseClass, globalResource, locale); } }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,String>createMessagesMap(Class<?> baseClass, String globalResource, Locale locale)Return a new messages map for the given baseClass (a page or control) and the given global resource bundle name.voidonDestroy()Destroy the MessagesMapService.voidonInit(jakarta.servlet.ServletContext servletContext)Initialize the MessagesMapService with the given application servlet context.
-
-
-
Method Detail
-
onInit
void onInit(jakarta.servlet.ServletContext servletContext) throws ExceptionInitialize the MessagesMapService with the given application servlet context. This method is invoked after the MessagesMapService has been constructed.- Parameters:
servletContext- the application servlet context- Throws:
Exception- if an error occurs initializing the LogService
-
onDestroy
void onDestroy()
Destroy the MessagesMapService.
-
createMessagesMap
Map<String,String> createMessagesMap(Class<?> baseClass, String globalResource, Locale locale)
Return a new messages map for the given baseClass (a page or control) and the given global resource bundle name.- Parameters:
baseClass- the target classglobalResource- the global resource bundle namelocale- the users Locale- Returns:
- a new messages map with the messages for the target.
-
-