Package com.aspectran.core.activity
Class CoreTranslet
- java.lang.Object
-
- com.aspectran.core.activity.AbstractTranslet
-
- com.aspectran.core.activity.CoreTranslet
-
- All Implemented Interfaces:
Translet
,BeanRegistry
,MessageSource
public class CoreTranslet extends AbstractTranslet
The Class CoreTranslet.This class is generally not thread-safe. It is primarily designed for use in a single thread only.
-
-
Constructor Summary
Constructors Constructor Description CoreTranslet(TransletRule transletRule, CoreActivity activity)
Instantiates a new CoreTranslet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsProfiles(java.lang.String... profiles)
Return whether the given profile is active.void
clearRaisedException()
boolean
containsBean(java.lang.Class<?> requiredType)
Return whether a bean with the specified object type is present.boolean
containsBean(java.lang.String id)
Return whether a bean with the specified id is present.void
dispatch(DispatchResponseRule dispatchResponseRule)
Dispatch to other resources as the given rule.void
dispatch(java.lang.String name)
Dispatch to other resources as the given name.void
dispatch(java.lang.String name, java.lang.String dispatcherName)
Dispatch to other resources as the given name.void
extractParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)
Extracts all the parameters and fills in the specified map.void
forward(ForwardResponseRule forwardResponseRule)
Forward according to a given rule.void
forward(java.lang.String transletName)
Forward to the specified translet immediately.ActivityDataMap
getActivityDataMap()
Returns an Activity Data Map containing the activity result data.ActivityDataMap
getActivityDataMap(boolean prefill)
Returns an Activity Data Map containing the activity result data.<T> T
getAfterAdviceResult(java.lang.String aspectId)
Gets the after advice result.java.util.Map<java.lang.String,java.lang.Object>
getAllParameters()
Return an mutable Map of the request parameters, with parameter names as map keys and parameter values as map values.<T> T
getApplicationAdaptee()
Returns the adaptee object to provide application information.ApplicationAdapter
getApplicationAdapter()
Gets the application adapter.<T> T
getAroundAdviceResult(java.lang.String aspectId)
Gets the around advice result.<T> T
getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.<T> T
getAttribute(java.lang.String name)
Returns the value of the named attribute as a given type, ornull
if no attribute of the given name exists.java.util.Collection<java.lang.String>
getAttributeNames()
Returns aCollection
containing the names of the attributes available to this request.<T> T
getBean(java.lang.Class<T> requiredType)
Return an instance of the bean that matches the given object type.<T> T
getBean(java.lang.Class<T> requiredType, java.lang.String id)
Return an instance of the bean that matches the given object type.<T> T
getBean(java.lang.String id)
Return an instance of the bean that matches the given id.<T> T
getBean(java.lang.String id, java.lang.Class<T> requiredType)
Return an instance of the bean that matches the given id.<T> T
getBeforeAdviceResult(java.lang.String aspectId)
Gets the before advice result.<T> T
getConfigBean(java.lang.Class<T> classType)
Return the bean instance that matches the specified object type.Response
getDeclaredResponse()
Returns the originally declared response.java.lang.String
getDescription()
Returns a description of thisTranslet
.Environment
getEnvironment()
Returns the environment of the current activity context.FileParameter
getFileParameter(java.lang.String name)
Returns aFileParameter
object as a given activity's request parameter name, ornull
if the parameter does not exist.java.util.Collection<java.lang.String>
getFileParameterNames()
Returns aCollection
ofString
objects containing the names of the file parameters contained in this request.FileParameter[]
getFileParameterValues(java.lang.String name)
Returns an array ofFileParameter
objects containing all of the values the given activity's request parameter has, ornull
if the parameter does not exist.<T> T
getFinallyAdviceResult(java.lang.String aspectId)
Gets the finally advice result.java.lang.String
getMessage(java.lang.String code, java.lang.Object[] args)
Try to resolve the message.java.lang.String
getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage)
Try to resolve the message.java.lang.String
getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)
Try to resolve the message.java.lang.String
getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale)
Try to resolve the message.java.lang.String
getParameter(java.lang.String name)
Returns the value of an activity's request parameter as aString
, ornull
if the parameter does not exist.java.util.Collection<java.lang.String>
getParameterNames()
Returns aCollection
ofString
objects containing the names of the parameters contained in this request.java.lang.String[]
getParameterValues(java.lang.String name)
Returns an array ofString
objects containing all of the values the given activity's request parameter has, ornull
if the parameter does not exist.ProcessResult
getProcessResult()
Returns the process result.java.lang.Object
getProcessResult(java.lang.String actionId)
Returns a action result for the specified action id from the process result, ornull
if the action does not exist.<T> T
getProperty(java.lang.String name)
Returns the value of the property on environment.java.lang.Throwable
getRaisedException()
Returns the raised exception instance.<T> T
getRequestAdaptee()
Returns the adaptee object to provide request information.RequestAdapter
getRequestAdapter()
Gets the request adapter.java.lang.String
getRequestEncoding()
Returns the request encoding.<T> T
getResponseAdaptee()
Returns the adaptee object to provide response information.ResponseAdapter
getResponseAdapter()
Gets the response adapter.java.lang.String
getResponseEncoding()
Returns the response encoding.java.lang.Throwable
getRootCauseOfRaisedException()
Returns the innermost one of the chained (wrapped) exceptions.<T> T
getSessionAdaptee()
Returns the adaptee object to provide session information.SessionAdapter
getSessionAdapter()
Gets the session adapter.<T> T
getSetting(java.lang.String settingName)
Gets the setting value in the translet scope.boolean
hasPathVariable()
boolean
isExceptionRaised()
Returns whether the exception was thrown.void
redirect(RedirectResponseRule redirectResponseRule)
Redirect a client according to the given rule.void
redirect(java.lang.String path)
Redirect a client to a new target resource.void
redirect(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> parameters)
Redirect to the other target resource.void
removeAttribute(java.lang.String name)
Removes an attribute from this request.void
removeFileParameter(java.lang.String name)
Removes the file parameter with the specified name.void
response()
Respond immediately, and the remaining jobs will be canceled.void
response(Response response)
Respond immediately, and the remaining jobs will be canceled.void
setAttribute(java.lang.String name, java.lang.Object value)
Stores an attribute in this request.void
setFileParameter(java.lang.String name, FileParameter fileParameter)
Sets theFileParameter
object to the file parameter with the given name.void
setFileParameter(java.lang.String name, FileParameter[] fileParameters)
Sets the value to the file parameter with the given name.void
setParameter(java.lang.String name, java.lang.String value)
Sets the value to the parameter with the given name.void
setParameter(java.lang.String name, java.lang.String[] values)
Sets the value to the parameter with the given name.void
setProcessResult(ProcessResult processResult)
Sets the process result.ProcessResult
touchProcessResult()
Returns the ProcessResult.ProcessResult
touchProcessResult(java.lang.String contentsName)
Returns the process result with the contents name.ProcessResult
touchProcessResult(java.lang.String contentsName, int initialCapacity)
Returns the process result with the contents name.void
transform(TransformRule transformRule)
Transformation according to a given rule, and transmits this response.-
Methods inherited from class com.aspectran.core.activity.AbstractTranslet
getRequestMethod, getRequestName, getRequestRule, getResponseRule, getTransletRule, setRequestMethod, setRequestName
-
-
-
-
Constructor Detail
-
CoreTranslet
public CoreTranslet(TransletRule transletRule, CoreActivity activity)
Instantiates a new CoreTranslet.- Parameters:
transletRule
- the translet ruleactivity
- the current Activity
-
-
Method Detail
-
getDescription
public java.lang.String getDescription()
Description copied from interface:Translet
Returns a description of thisTranslet
.- Returns:
- a description of this
Translet
-
getEnvironment
public Environment getEnvironment()
Description copied from interface:Translet
Returns the environment of the current activity context.- Returns:
- the environment
-
getApplicationAdapter
public ApplicationAdapter getApplicationAdapter()
Description copied from interface:Translet
Gets the application adapter.- Returns:
- the application adapter
-
getSessionAdapter
public SessionAdapter getSessionAdapter()
Description copied from interface:Translet
Gets the session adapter.- Returns:
- the session adapter
-
getRequestAdapter
public RequestAdapter getRequestAdapter()
Description copied from interface:Translet
Gets the request adapter.- Returns:
- the request adapter
-
getResponseAdapter
public ResponseAdapter getResponseAdapter()
Description copied from interface:Translet
Gets the response adapter.- Returns:
- the response adapter
-
getApplicationAdaptee
public <T> T getApplicationAdaptee()
Description copied from interface:Translet
Returns the adaptee object to provide application information.- Type Parameters:
T
- the type of the application adaptee- Returns:
- the application adaptee object
-
getSessionAdaptee
public <T> T getSessionAdaptee()
Description copied from interface:Translet
Returns the adaptee object to provide session information.- Type Parameters:
T
- the type of the session adaptee- Returns:
- the session adaptee object
-
getRequestAdaptee
public <T> T getRequestAdaptee()
Description copied from interface:Translet
Returns the adaptee object to provide request information.- Type Parameters:
T
- the type of the request adaptee- Returns:
- the request adaptee object
-
getResponseAdaptee
public <T> T getResponseAdaptee()
Description copied from interface:Translet
Returns the adaptee object to provide response information.- Type Parameters:
T
- the type of the response adaptee- Returns:
- the response adaptee object
-
getRequestEncoding
public java.lang.String getRequestEncoding()
Description copied from interface:Translet
Returns the request encoding.- Returns:
- the request encoding
-
getResponseEncoding
public java.lang.String getResponseEncoding()
Description copied from interface:Translet
Returns the response encoding.- Returns:
- the response encoding
-
getProcessResult
public ProcessResult getProcessResult()
Description copied from interface:Translet
Returns the process result.- Returns:
- the process result
-
getProcessResult
public java.lang.Object getProcessResult(java.lang.String actionId)
Description copied from interface:Translet
Returns a action result for the specified action id from the process result, ornull
if the action does not exist.- Parameters:
actionId
- the specified action id- Returns:
- the action result
-
setProcessResult
public void setProcessResult(ProcessResult processResult)
Description copied from interface:Translet
Sets the process result.- Parameters:
processResult
- the new process result
-
touchProcessResult
public ProcessResult touchProcessResult()
Description copied from interface:Translet
Returns the ProcessResult. If not yet instantiated then create a new one.- Returns:
- the process result
-
touchProcessResult
public ProcessResult touchProcessResult(java.lang.String contentsName)
Description copied from interface:Translet
Returns the process result with the contents name. If not yet instantiated then create a new one.- Parameters:
contentsName
- the contents name- Returns:
- the process result
-
touchProcessResult
public ProcessResult touchProcessResult(java.lang.String contentsName, int initialCapacity)
Description copied from interface:Translet
Returns the process result with the contents name. If not yet instantiated then create a new one.- Parameters:
contentsName
- the contents nameinitialCapacity
- the initial capacity of the process result- Returns:
- the process result
-
getActivityDataMap
public ActivityDataMap getActivityDataMap()
Description copied from interface:Translet
Returns an Activity Data Map containing the activity result data.- Returns:
- the activity data map
-
getActivityDataMap
public ActivityDataMap getActivityDataMap(boolean prefill)
Description copied from interface:Translet
Returns an Activity Data Map containing the activity result data.- Parameters:
prefill
- whether data pre-fill.- Returns:
- the activity data map
-
getSetting
public <T> T getSetting(java.lang.String settingName)
Description copied from interface:Translet
Gets the setting value in the translet scope.- Type Parameters:
T
- the type of the value- Parameters:
settingName
- the setting name- Returns:
- the setting value
-
getProperty
public <T> T getProperty(java.lang.String name)
Description copied from interface:Translet
Returns the value of the property on environment.- Type Parameters:
T
- the type of the value- Parameters:
name
- the given property name- Returns:
- the value of the property on environment
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Description copied from interface:Translet
Returns the value of an activity's request parameter as aString
, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the parameter- Returns:
- a
String
representing the single value of the parameter - See Also:
Translet.getParameterValues(java.lang.String)
-
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
Description copied from interface:Translet
Returns an array ofString
objects containing all of the values the given activity's request parameter has, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the parameter- Returns:
- an array of
String
objects containing the parameter's values - See Also:
Translet.getParameter(java.lang.String)
-
getParameterNames
public java.util.Collection<java.lang.String> getParameterNames()
Description copied from interface:Translet
Returns aCollection
ofString
objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an emptyCollection
.- Returns:
- an
Collection
ofString
objects, eachString
containing the name of a request parameter; or an emptyCollection
if the request has no parameters
-
setParameter
public void setParameter(java.lang.String name, java.lang.String value)
Description copied from interface:Translet
Sets the value to the parameter with the given name.- Parameters:
name
- aString
specifying the name of the parametervalue
- aString
representing the single value of the parameter- See Also:
Translet.setParameter(String, String[])
-
setParameter
public void setParameter(java.lang.String name, java.lang.String[] values)
Description copied from interface:Translet
Sets the value to the parameter with the given name.- Parameters:
name
- aString
specifying the name of the parametervalues
- an array ofString
objects containing the parameter's values- See Also:
Translet.setParameter(java.lang.String, java.lang.String)
-
getAllParameters
public java.util.Map<java.lang.String,java.lang.Object> getAllParameters()
Description copied from interface:Translet
Return an mutable Map of the request parameters, with parameter names as map keys and parameter values as map values. If the parameter value type is theString
then map value will be of typeString
. If the parameter value type is theString
array then map value will be of typeString
array.- Returns:
- the mutable parameter map
-
extractParameters
public void extractParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)
Description copied from interface:Translet
Extracts all the parameters and fills in the specified map.- Parameters:
targetParameters
- the target parameter map to be filled
-
getFileParameter
public FileParameter getFileParameter(java.lang.String name)
Description copied from interface:Translet
Returns aFileParameter
object as a given activity's request parameter name, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the file parameter- Returns:
- a
FileParameter
representing the single value of the parameter - See Also:
Translet.getFileParameterValues(java.lang.String)
-
getFileParameterValues
public FileParameter[] getFileParameterValues(java.lang.String name)
Description copied from interface:Translet
Returns an array ofFileParameter
objects containing all of the values the given activity's request parameter has, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the file parameter- Returns:
- an array of
FileParameter
objects containing the parameter's values - See Also:
Translet.getFileParameter(java.lang.String)
-
getFileParameterNames
public java.util.Collection<java.lang.String> getFileParameterNames()
Description copied from interface:Translet
Returns aCollection
ofString
objects containing the names of the file parameters contained in this request. If the request has no parameters, the method returns an emptyCollection
.- Returns:
- an
Collection
ofString
objects, eachString
containing the name of a file parameter; or an emptyCollection
if the request has no file parameters
-
setFileParameter
public void setFileParameter(java.lang.String name, FileParameter fileParameter)
Description copied from interface:Translet
Sets theFileParameter
object to the file parameter with the given name.- Parameters:
name
- aString
specifying the name of the file parameterfileParameter
- aFileParameter
representing the single value of the parameter- See Also:
Translet.setFileParameter(String, FileParameter[])
-
setFileParameter
public void setFileParameter(java.lang.String name, FileParameter[] fileParameters)
Description copied from interface:Translet
Sets the value to the file parameter with the given name.- Parameters:
name
- aString
specifying the name of the file parameterfileParameters
- an array ofFileParameter
objects containing the file parameter's values- See Also:
Translet.setFileParameter(java.lang.String, com.aspectran.core.activity.request.parameter.FileParameter)
-
removeFileParameter
public void removeFileParameter(java.lang.String name)
Description copied from interface:Translet
Removes the file parameter with the specified name.- Parameters:
name
- aString
specifying the name of the file parameter
-
getAttribute
public <T> T getAttribute(java.lang.String name)
Description copied from interface:Translet
Returns the value of the named attribute as a given type, ornull
if no attribute of the given name exists.- Type Parameters:
T
- the generic type- Parameters:
name
- aString
specifying the name of the attribute- Returns:
- an
Object
containing the value of the attribute, ornull
if the attribute does not exist
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
Description copied from interface:Translet
Stores an attribute in this request.- Parameters:
name
- specifying the name of the attributevalue
- theObject
to be stored
-
getAttributeNames
public java.util.Collection<java.lang.String> getAttributeNames()
Description copied from interface:Translet
Returns aCollection
containing the names of the attributes available to this request. This method returns an emptyCollection
if the request has no attributes available to it.- Returns:
- the attribute names
-
removeAttribute
public void removeAttribute(java.lang.String name)
Description copied from interface:Translet
Removes an attribute from this request.- Parameters:
name
- aString
specifying the name of the attribute to remove
-
getDeclaredResponse
public Response getDeclaredResponse()
Description copied from interface:Translet
Returns the originally declared response.- Returns:
- the declared response
-
response
public void response()
Description copied from interface:Translet
Respond immediately, and the remaining jobs will be canceled.
-
response
public void response(Response response)
Description copied from interface:Translet
Respond immediately, and the remaining jobs will be canceled.- Parameters:
response
- the response
-
transform
public void transform(TransformRule transformRule)
Description copied from interface:Translet
Transformation according to a given rule, and transmits this response.- Parameters:
transformRule
- the transformation rule
-
dispatch
public void dispatch(java.lang.String name)
Description copied from interface:Translet
Dispatch to other resources as the given name.- Parameters:
name
- the dispatch name
-
dispatch
public void dispatch(java.lang.String name, java.lang.String dispatcherName)
Description copied from interface:Translet
Dispatch to other resources as the given name.- Parameters:
name
- the dispatch namedispatcherName
- the id or class name of the view dispatcher bean
-
dispatch
public void dispatch(DispatchResponseRule dispatchResponseRule)
Description copied from interface:Translet
Dispatch to other resources as the given rule.- Parameters:
dispatchResponseRule
- the dispatch response rule
-
forward
public void forward(java.lang.String transletName)
Description copied from interface:Translet
Forward to the specified translet immediately.- Parameters:
transletName
- the translet name of the target to be forwarded
-
forward
public void forward(ForwardResponseRule forwardResponseRule)
Description copied from interface:Translet
Forward according to a given rule.- Parameters:
forwardResponseRule
- the forward response rule
-
redirect
public void redirect(java.lang.String path)
Description copied from interface:Translet
Redirect a client to a new target resource. If an intended redirect response rule exists, that may be used.- Parameters:
path
- the redirect path
-
redirect
public void redirect(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> parameters)
Description copied from interface:Translet
Redirect to the other target resource.- Parameters:
path
- the redirect pathparameters
- the parameters
-
redirect
public void redirect(RedirectResponseRule redirectResponseRule)
Description copied from interface:Translet
Redirect a client according to the given rule.- Parameters:
redirectResponseRule
- the redirect response rule
-
isExceptionRaised
public boolean isExceptionRaised()
Description copied from interface:Translet
Returns whether the exception was thrown.- Returns:
- true, if is exception raised
-
getRaisedException
public java.lang.Throwable getRaisedException()
Description copied from interface:Translet
Returns the raised exception instance.- Returns:
- the raised exception instance
-
clearRaisedException
public void clearRaisedException()
-
getRootCauseOfRaisedException
public java.lang.Throwable getRootCauseOfRaisedException()
Description copied from interface:Translet
Returns the innermost one of the chained (wrapped) exceptions.- Returns:
- the innermost one of the chained (wrapped) exceptions
-
acceptsProfiles
public boolean acceptsProfiles(java.lang.String... profiles)
Description copied from interface:Translet
Return whether the given profile is active. If active profiles are empty whether the profile should be active by default.- Parameters:
profiles
- the profiles- Returns:
true
if profile is active, otherwisefalse
-
getAspectAdviceBean
public <T> T getAspectAdviceBean(java.lang.String aspectId)
Description copied from interface:Translet
Gets the aspect advice bean.- Type Parameters:
T
- the generic type- Parameters:
aspectId
- the aspect id- Returns:
- the aspect advice bean
-
getBeforeAdviceResult
public <T> T getBeforeAdviceResult(java.lang.String aspectId)
Description copied from interface:Translet
Gets the before advice result.- Type Parameters:
T
- the generic type- Parameters:
aspectId
- the aspect id- Returns:
- the before advice result
-
getAfterAdviceResult
public <T> T getAfterAdviceResult(java.lang.String aspectId)
Description copied from interface:Translet
Gets the after advice result.- Type Parameters:
T
- the generic type- Parameters:
aspectId
- the aspect id- Returns:
- the after advice result
-
getAroundAdviceResult
public <T> T getAroundAdviceResult(java.lang.String aspectId)
Description copied from interface:Translet
Gets the around advice result.- Type Parameters:
T
- the generic type- Parameters:
aspectId
- the aspect id- Returns:
- the around advice result
-
getFinallyAdviceResult
public <T> T getFinallyAdviceResult(java.lang.String aspectId)
Description copied from interface:Translet
Gets the finally advice result.- Type Parameters:
T
- the generic type- Parameters:
aspectId
- the aspect id- Returns:
- the finally advice result
-
hasPathVariable
public boolean hasPathVariable()
-
getBean
public <T> T getBean(java.lang.String id)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given id.- Type Parameters:
T
- the generic type- Parameters:
id
- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
public <T> T getBean(java.lang.Class<T> requiredType)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given object type.- Type Parameters:
T
- the generic type- Parameters:
requiredType
- the type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
-
getBean
public <T> T getBean(java.lang.String id, java.lang.Class<T> requiredType)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given id. If the bean is not of the required type then throw a BeanNotOfRequiredTypeException.- Type Parameters:
T
- the generic type- Parameters:
id
- the id of the bean to retrieverequiredType
- type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
-
getBean
public <T> T getBean(java.lang.Class<T> requiredType, java.lang.String id)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given object type. If the bean is not exists ,retrieve the bean with the specified id.- Type Parameters:
T
- the generic type- Parameters:
requiredType
- type the bean must match; can be an interface or superclass.null
is allowed.id
- the id of the bean to retrieve; if requiredType isnull
.- Returns:
- an instance of the bean
-
getConfigBean
public <T> T getConfigBean(java.lang.Class<T> classType)
Description copied from interface:BeanRegistry
Return the bean instance that matches the specified object type. If the bean is not of the required type then throw aBeanNotOfRequiredTypeException
.- Type Parameters:
T
- the generic type- Parameters:
classType
- type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
-
containsBean
public boolean containsBean(java.lang.String id)
Description copied from interface:BeanRegistry
Return whether a bean with the specified id is present.- Parameters:
id
- the id of the bean to query- Returns:
- whether a bean with the specified id is present
-
containsBean
public boolean containsBean(java.lang.Class<?> requiredType)
Description copied from interface:BeanRegistry
Return whether a bean with the specified object type is present.- Parameters:
requiredType
- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
getMessage
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)
Description copied from interface:MessageSource
Try to resolve the message. Return default message if no message was found.- Parameters:
code
- the code to lookup up, such as 'calculator.noRateSet'. Users of this class are encouraged to base message names on the relevant fully qualified class name, thus avoiding conflict and ensuring maximum clarity.args
- array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), ornull
if none.defaultMessage
- String to return if the lookup failslocale
- the Locale in which to do the lookup- Returns:
- the resolved message if the lookup was successful; otherwise the default message passed as a parameter
- See Also:
MessageFormat
-
getMessage
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale) throws NoSuchMessageException
Description copied from interface:MessageSource
Try to resolve the message. Treat as an error if the message can't be found.- Parameters:
code
- the code to lookup up, such as 'calculator.noRateSet'args
- Array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), ornull
if none.locale
- the Locale in which to do the lookup- Returns:
- the resolved message
- Throws:
NoSuchMessageException
- if the message wasn't found- See Also:
MessageFormat
-
getMessage
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage)
Description copied from interface:Translet
Try to resolve the message. Return default message if no message was found.- Parameters:
code
- the code to lookup up, such as 'calculator.noRateSet'. Users of this class are encouraged to base message names on the relevant fully qualified class name, thus avoiding conflict and ensuring maximum clarity.args
- array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), ornull
if none.defaultMessage
- String to return if the lookup fails- Returns:
- the resolved message if the lookup was successful; otherwise the default message passed as a parameter
- See Also:
MessageFormat
-
getMessage
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args) throws NoSuchMessageException
Description copied from interface:Translet
Try to resolve the message. Treat as an error if the message can't be found.- Parameters:
code
- the code to lookup up, such as 'calculator.noRateSet'args
- Array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), ornull
if none.- Returns:
- the resolved message
- Throws:
NoSuchMessageException
- if the message wasn't found- See Also:
MessageFormat
-
-