public class ComponentPageElementResourcesImpl extends Object implements ComponentPageElementResources
Constructor and Description |
---|
ComponentPageElementResourcesImpl(ComponentResourceSelector selector,
ComponentMessagesSource componentMessagesSource,
TypeCoercer typeCoercer,
ComponentClassCache componentClassCache,
ContextValueEncoder contextValueEncoder,
LinkSource linkSource,
RequestPageCache requestPageCache,
ComponentClassResolver componentClassResolver,
LoggerSource loggerSource,
OperationTracker tracker,
PerthreadManager perThreadManager,
boolean productionMode,
boolean componentTracingEnabled,
RequestGlobals requestGlobals) |
Modifier and Type | Method and Description |
---|---|
<S,T> T |
coerce(S input,
Class<T> targetType)
Performs a coercion from an input type to a desired output type.
|
Link |
createComponentEventLink(ComponentResources resources,
String eventType,
boolean forForm,
Object... context)
Creates a link on behalf of a component.
|
Link |
createPageRenderLink(Class pageClass,
boolean override,
Object... context)
Creates a page render request link to render a specific page.
|
Link |
createPageRenderLink(String pageName,
boolean override,
Object... context)
Creates a page render request link to render a specific page.
|
<T> PerThreadValue<T> |
createPerThreadValue()
Wrapper around
PerthreadManager.createValue() . |
org.slf4j.Logger |
getEventLogger(org.slf4j.Logger componentLogger)
Returns the event logger for the provided component logger.
|
Messages |
getMessages(ComponentModel componentModel)
Used to obtain a
Messages instance for a particular component. |
ComponentResourceSelector |
getSelector()
Returns the selector associated with this resources.
|
<T> T |
invoke(String description,
Invokable<T> operation)
As with
OperationTracker.run(String, Runnable) , but the operation may return a value. |
boolean |
isRenderTracingEnabled()
Returns true if component element tracing is enabled.
|
<T> T |
perform(String description,
IOOperation<T> operation)
As with
OperationTracker.invoke(String, Invokable) , but the operation may throw an IOException . |
void |
run(String description,
Runnable operation)
Executes the operation.
|
Class |
toClass(String className)
Gets the Class instance for then give name.
|
String |
toClient(Object value)
Converts a context value into a client-side string (that will ultimately be encoded into a URL).
|
<T> T |
toValue(Class<T> requiredType,
String clientValue)
Converts a client value back into a server-side object.
|
public ComponentPageElementResourcesImpl(ComponentResourceSelector selector, ComponentMessagesSource componentMessagesSource, TypeCoercer typeCoercer, ComponentClassCache componentClassCache, ContextValueEncoder contextValueEncoder, LinkSource linkSource, RequestPageCache requestPageCache, ComponentClassResolver componentClassResolver, LoggerSource loggerSource, OperationTracker tracker, PerthreadManager perThreadManager, boolean productionMode, boolean componentTracingEnabled, RequestGlobals requestGlobals)
public ComponentResourceSelector getSelector()
ComponentPageElementResources
getSelector
in interface ComponentPageElementResources
public Messages getMessages(ComponentModel componentModel)
ComponentPageElementResources
Messages
instance for a particular component. If the component
extends from another component, then its localized properties will merge with its parent's properties (with the
subclass overriding the super class on any conflicts).getMessages
in interface ComponentPageElementResources
ComponentMessagesSource
public <S,T> T coerce(S input, Class<T> targetType)
ComponentPageElementResources
coerce
in interface ComponentPageElementResources
S
- source type (input)T
- target type (output)targetType
- defines the target typeTypeCoercer
public Class toClass(String className)
ComponentPageElementResources
toClass
in interface ComponentPageElementResources
className
- fully qualified class nameComponentClassCache
public Link createComponentEventLink(ComponentResources resources, String eventType, boolean forForm, Object... context)
ComponentPageElementResources
createComponentEventLink
in interface ComponentPageElementResources
resources
- resources for the componenteventType
- type of event to createforForm
- true if generating for a form submissioncontext
- additional event context associated with the linkpublic Link createPageRenderLink(String pageName, boolean override, Object... context)
ComponentPageElementResources
createPageRenderLink
in interface ComponentPageElementResources
pageName
- the logical name of the page to link tooverride
- if true, the context is used even if empty (normally, the target page is allowed to passivate,
providing a context, when the provided context is empty)context
- the activation context for the page. If omitted, the activation context is obtained from the
target pagepublic Link createPageRenderLink(Class pageClass, boolean override, Object... context)
ComponentPageElementResources
createPageRenderLink
in interface ComponentPageElementResources
pageClass
- identifies the page to link tooverride
- if true, the context is used even if empty (normally, the target page is allowed to passivate,
providing a context, when the provided context is empty)context
- the activation context for the page. If omitted, the activation context is obtained from the
target pagepublic org.slf4j.Logger getEventLogger(org.slf4j.Logger componentLogger)
ComponentPageElementResources
getEventLogger
in interface ComponentPageElementResources
componentLogger
- provides base name for loggerpublic String toClient(Object value)
ContextValueEncoder
toClient
in interface ContextValueEncoder
value
- to convert (may not be null)ValueEncoder.toClient(Object)
public <T> T toValue(Class<T> requiredType, String clientValue)
ContextValueEncoder
toValue
in interface ContextValueEncoder
requiredType
- required type to convert the string toclientValue
- value obtained from context passed from clientValueEncoder.toValue(String)
public <T> T invoke(String description, Invokable<T> operation)
OperationTracker
OperationTracker.run(String, Runnable)
, but the operation may return a value.invoke
in interface OperationTracker
description
- used if there is an exceptionoperation
- to invokepublic <T> T perform(String description, IOOperation<T> operation) throws IOException
OperationTracker
OperationTracker.invoke(String, Invokable)
, but the operation may throw an IOException
.perform
in interface OperationTracker
description
- used if there is an exception (outside of IOException)operation
- to performIOException
public void run(String description, Runnable operation)
OperationTracker
RuntimeException
it will be logged and rethrown
wrapped as a OperationException
.run
in interface OperationTracker
description
- used if there is an exceptionoperation
- to executepublic <T> PerThreadValue<T> createPerThreadValue()
ComponentPageElementResources
PerthreadManager.createValue()
.createPerThreadValue
in interface ComponentPageElementResources
public boolean isRenderTracingEnabled()
ComponentPageElementResources
isRenderTracingEnabled
in interface ComponentPageElementResources
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.