Package cimerant.context.json.impl
Class JsonContextImpl
java.lang.Object
org.apache.velocity.context.AbstractContext
org.apache.velocity.VelocityContext
cimerant.context.impl.ContextRootImpl<E>
cimerant.context.cimerant.impl.ObjectContextImpl<Map.Entry<String,Object>>
cimerant.context.json.impl.JsonContextImpl
- All Implemented Interfaces:
ObjectContext<Map.Entry<String,
,Object>> ContextRoot<Map.Entry<String,
,Object>> JsonContext
,Serializable
,Cloneable
,Context
,InternalEventContext
public final class JsonContextImpl
extends ObjectContextImpl<Map.Entry<String,Object>>
implements JsonContext
Class describing the template data context. This set of routines is used by the template to set
and get 'named' data object to pass them to the template engine to use when rendering a template.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetAttributeByName
(String name) Returns the attribute to which the specified name is mapped, ornull
if this context contains no mapping for the name.getAttributeByName
(String name, Object defaultValue) Returns the attribute of this context by the name of the attribute supplying a default value if the attribute is not found.Returns all attributes of this context.int
getFieldAttributeByName
(String fieldName, String attributeName) Returns the attribute for a field by the name of the field and attribute.getFieldAttributeByName
(String fieldName, String attributeName, Object defaultValue) Returns the attribute for a field by the name of the field and attribute supplying a default value if the attribute is not found.getFieldByName
(String name) Returns the field of this context by the name of the field.Returns all fields of this context.static JsonContext
getInstance
(JsonRootContext parent, List<String> parentGroupings, Map.Entry<String, Object> entry) Global access point to get a instance of the context, ensuring that only one instance of the context exists.String[]
getRelationshipAttributeByName
(String relationshipName, String attributeName) Returns the attribute for a relationship by the name of the relationship and attribute.getRelationshipAttributeByName
(String relationshipName, String attributeName, Object defaultValue) Returns the attribute for a relationship by the name of the relationship and attribute supplying a default value if the attribute is not found.getRelationshipByName
(String name) Returns the relationship of this context by the name of the relationship.Returns all relationship of this context.String[]
boolean
hasAttributeByName
(String name) Returnstrue
if this context contains a attribute for the specified name.boolean
hasFieldAttributeByName
(String fieldName, String attributeName) Returnstrue
if the context has the value to which the specified key is mapped, ornull
if this context contains no mapping for the key.boolean
hasFieldByName
(String name) Returnstrue
if this context contains a field for the specified name.boolean
hasRelationshipAttributeByName
(String relationshipName, String attributeName) Returnstrue
if the context has the value to which the specified key is mapped, ornull
if this context contains no mapping for the key.boolean
hasRelationshipByName
(String name) Returnstrue
if this context contains a relationship for the specified name.void
icachePut
(Object arg0, IntrospectionCacheData arg1) void
void
void
pushCurrentMacroName
(String arg0) void
void
setCurrentResource
(Resource arg0) void
setMacroLibraries
(List<Template> arg0) Methods inherited from class cimerant.context.cimerant.impl.ObjectContextImpl
getObjectName, getRelatedObjectsByName, getRoot
Methods inherited from class cimerant.context.impl.ContextRootImpl
backSlashLowerCase, backSlashLowerCase, backSlashTitleCase, backSlashTitleCase, backSlashUpperCase, backSlashUpperCase, camelCase, camelCase, clearInstances, contextContainsKey, contextGet, contextGetKeys, contextPut, contextRemove, dotLowerCase, dotLowerCase, dotTitleCase, dotTitleCase, dotUpperCase, dotUpperCase, forwardSlashLowerCase, forwardSlashLowerCase, forwardSlashTitleCase, forwardSlashTitleCase, forwardSlashUpperCase, forwardSlashUpperCase, getContextClass, getContextObject, getFileExtension, getFileName, getFilePath, getGrouping, getInstance, isCollectionContext, isMapContext, isMapEntryContext, isNumericClass, isSetContext, isStringContext, kebabLowerCase, kebabLowerCase, kebabTitleCase, kebabTitleCase, kebabUpperCase, kebabUpperCase, lowerCase, lowerCase, lowerFirst, lowerFirst, pascalCase, pascalCase, pluralBackSlashLowerCase, pluralBackSlashLowerCase, pluralBackSlashTitleCase, pluralBackSlashTitleCase, pluralBackSlashUpperCase, pluralBackSlashUpperCase, pluralCamelCase, pluralCamelCase, pluralDotLowerCase, pluralDotLowerCase, pluralDotTitleCase, pluralDotTitleCase, pluralDotUpperCase, pluralDotUpperCase, pluralForwardSlashLowerCase, pluralForwardSlashLowerCase, pluralForwardSlashTitleCase, pluralForwardSlashTitleCase, pluralForwardSlashUpperCase, pluralForwardSlashUpperCase, pluralKebabLowerCase, pluralKebabLowerCase, pluralKebabTitleCase, pluralKebabTitleCase, pluralKebabUpperCase, pluralKebabUpperCase, pluralLowerCase, pluralLowerCase, pluralLowerFirst, pluralLowerFirst, pluralPascalCase, pluralPascalCase, pluralSnakeLowerCase, pluralSnakeLowerCase, pluralSnakeTitleCase, pluralSnakeTitleCase, pluralSnakeUpperCase, pluralSnakeUpperCase, pluralTitleCase, pluralTitleCase, pluralUpperCase, pluralUpperCase, pluralUpperFirst, pluralUpperFirst, registerInstance, setFileExtension, setFileName, setFilePath, setGrouping, setObjectName, singularBackSlashLowerCase, singularBackSlashLowerCase, singularBackSlashTitleCase, singularBackSlashTitleCase, singularBackSlashUpperCase, singularBackSlashUpperCase, singularCamelCase, singularCamelCase, singularDotLowerCase, singularDotLowerCase, singularDotTitleCase, singularDotTitleCase, singularDotUpperCase, singularDotUpperCase, singularForwardSlashLowerCase, singularForwardSlashLowerCase, singularForwardSlashTitleCase, singularForwardSlashTitleCase, singularForwardSlashUpperCase, singularForwardSlashUpperCase, singularKebabLowerCase, singularKebabLowerCase, singularKebabTitleCase, singularKebabTitleCase, singularKebabUpperCase, singularKebabUpperCase, singularLowerCase, singularLowerCase, singularLowerFirst, singularLowerFirst, singularPascalCase, singularPascalCase, singularSnakeLowerCase, singularSnakeLowerCase, singularSnakeTitleCase, singularSnakeTitleCase, singularSnakeUpperCase, singularSnakeUpperCase, singularTitleCase, singularTitleCase, singularUpperCase, singularUpperCase, singularUpperFirst, singularUpperFirst, snakeLowerCase, snakeLowerCase, snakeTitleCase, snakeTitleCase, snakeUpperCase, snakeUpperCase, titleCase, titleCase, toJson, upperCase, upperCase, upperFirst, upperFirst
Methods inherited from class org.apache.velocity.VelocityContext
clone, internalContainsKey, internalGet, internalGetKeys, internalPut, internalRemove
Methods inherited from class org.apache.velocity.context.AbstractContext
containsKey, get, getChainedContext, getKeys, put, remove
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.velocity.context.Context
containsKey, get, getKeys, put, remove
Methods inherited from interface cimerant.context.ContextRoot
backSlashLowerCase, backSlashLowerCase, backSlashTitleCase, backSlashTitleCase, backSlashUpperCase, backSlashUpperCase, camelCase, camelCase, contextContainsKey, contextGet, contextGetKeys, contextPut, contextRemove, dotLowerCase, dotLowerCase, dotTitleCase, dotTitleCase, dotUpperCase, dotUpperCase, forwardSlashLowerCase, forwardSlashLowerCase, forwardSlashTitleCase, forwardSlashTitleCase, forwardSlashUpperCase, forwardSlashUpperCase, getContextClass, getFileExtension, getFileName, getFilePath, getGrouping, getObjectName, isNumericClass, kebabLowerCase, kebabLowerCase, kebabTitleCase, kebabTitleCase, kebabUpperCase, kebabUpperCase, lowerCase, lowerCase, lowerFirst, lowerFirst, pascalCase, pascalCase, pluralBackSlashLowerCase, pluralBackSlashLowerCase, pluralBackSlashTitleCase, pluralBackSlashTitleCase, pluralBackSlashUpperCase, pluralBackSlashUpperCase, pluralCamelCase, pluralCamelCase, pluralDotLowerCase, pluralDotLowerCase, pluralDotTitleCase, pluralDotTitleCase, pluralDotUpperCase, pluralDotUpperCase, pluralForwardSlashLowerCase, pluralForwardSlashLowerCase, pluralForwardSlashTitleCase, pluralForwardSlashTitleCase, pluralForwardSlashUpperCase, pluralForwardSlashUpperCase, pluralKebabLowerCase, pluralKebabLowerCase, pluralKebabTitleCase, pluralKebabTitleCase, pluralKebabUpperCase, pluralKebabUpperCase, pluralLowerCase, pluralLowerCase, pluralLowerFirst, pluralLowerFirst, pluralPascalCase, pluralPascalCase, pluralSnakeLowerCase, pluralSnakeLowerCase, pluralSnakeTitleCase, pluralSnakeTitleCase, pluralSnakeUpperCase, pluralSnakeUpperCase, pluralTitleCase, pluralTitleCase, pluralUpperCase, pluralUpperCase, pluralUpperFirst, pluralUpperFirst, setFileExtension, setFileName, setFilePath, setGrouping, setObjectName, singularBackSlashLowerCase, singularBackSlashLowerCase, singularBackSlashTitleCase, singularBackSlashTitleCase, singularBackSlashUpperCase, singularBackSlashUpperCase, singularCamelCase, singularCamelCase, singularDotLowerCase, singularDotLowerCase, singularDotTitleCase, singularDotTitleCase, singularDotUpperCase, singularDotUpperCase, singularForwardSlashLowerCase, singularForwardSlashLowerCase, singularForwardSlashTitleCase, singularForwardSlashTitleCase, singularForwardSlashUpperCase, singularForwardSlashUpperCase, singularKebabLowerCase, singularKebabLowerCase, singularKebabTitleCase, singularKebabTitleCase, singularKebabUpperCase, singularKebabUpperCase, singularLowerCase, singularLowerCase, singularLowerFirst, singularLowerFirst, singularPascalCase, singularPascalCase, singularSnakeLowerCase, singularSnakeLowerCase, singularSnakeTitleCase, singularSnakeTitleCase, singularSnakeUpperCase, singularSnakeUpperCase, singularTitleCase, singularTitleCase, singularUpperCase, singularUpperCase, singularUpperFirst, singularUpperFirst, snakeLowerCase, snakeLowerCase, snakeTitleCase, snakeTitleCase, snakeUpperCase, snakeUpperCase, titleCase, titleCase, upperCase, upperCase, upperFirst, upperFirst
Methods inherited from interface cimerant.context.cimerant.ObjectContext
getRelatedObjectsByName, getRoot
-
Method Details
-
getInstance
public static JsonContext getInstance(JsonRootContext parent, List<String> parentGroupings, Map.Entry<String, Object> entry) Global access point to get a instance of the context, ensuring that only one instance of the context exists.- Parameters:
parent
- the context parent.parentGroupings
- the context parent grouping.entry
- the context entry.- Returns:
- a instance of the context.
-
getAttributeByName
Returns the attribute to which the specified name is mapped, ornull
if this context contains no mapping for the name.- Specified by:
getAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- the name whose associated attribute to be returned.- Returns:
- the attribute to which the specified name is mapped, or
null
if this context contains no mapping for the name.
-
getAttributeByName
Returns the attribute of this context by the name of the attribute supplying a default value if the attribute is not found.- Specified by:
getAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- name the name whose associated attribute to be returned.defaultValue
- the attribute that is returned when an explicit attribute is not available.- Returns:
- the attribute of this context by the name of the attribute supplying a default value if the attribute is not found.
-
getAttributes
Returns all attributes of this context.- Specified by:
getAttributes
in interfaceObjectContext<Map.Entry<String,
Object>> - Returns:
- all attributes of this context.
-
getFieldAttributeByName
Returns the attribute for a field by the name of the field and attribute.- Specified by:
getFieldAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
fieldName
- the name of the field whose associated attribute to be returned.attributeName
- the name whose associated attribute to be returned.- Returns:
- the attribute for a field by the name of the field and attribute.
-
getFieldAttributeByName
Returns the attribute for a field by the name of the field and attribute supplying a default value if the attribute is not found.- Specified by:
getFieldAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
fieldName
- the name of the field whose associated attribute to be returned.attributeName
- the name whose associated attribute to be returned.defaultValue
- the value that is returned when an explicit value is not available.- Returns:
- the attribute for a field by the name of the field and attribute supplying a default value if the attribute is not found.
-
getFieldByName
Returns the field of this context by the name of the field.- Specified by:
getFieldByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- name the name whose associated field to be returned.- Returns:
- the field of this context by the name of the field.
-
getFields
Returns all fields of this context.- Specified by:
getFields
in interfaceObjectContext<Map.Entry<String,
Object>> - Returns:
- all fields of this context.
-
getRelationshipAttributeByName
Returns the attribute for a relationship by the name of the relationship and attribute.- Specified by:
getRelationshipAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
relationshipName
- the name of the relationship whose associated attribute to be returned.attributeName
- the name whose associated attribute to be returned.- Returns:
- the attribute for a relationship by the name of the relationship and attribute.
-
getRelationshipAttributeByName
public Object getRelationshipAttributeByName(String relationshipName, String attributeName, Object defaultValue) Returns the attribute for a relationship by the name of the relationship and attribute supplying a default value if the attribute is not found.- Specified by:
getRelationshipAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
relationshipName
- the name of the relationship whose associated attribute to be returned.attributeName
- the name whose associated attribute to be returned.defaultValue
- the value that is returned when an explicit value is not available.- Returns:
- the attribute for a relationship by the name of the relationship and attribute supplying a default value if the attribute is not found.
-
getRelationshipByName
Returns the relationship of this context by the name of the relationship.- Specified by:
getRelationshipByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- name the name whose associated relationship to be returned.- Returns:
- the relationship of this context by the name of the relationship.
-
getRelationships
Returns all relationship of this context.- Specified by:
getRelationships
in interfaceObjectContext<Map.Entry<String,
Object>> - Returns:
- all relationship of this context.
-
hasAttributeByName
Returnstrue
if this context contains a attribute for the specified name.- Specified by:
hasAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- name the name whose associated relationship to be returned.- Returns:
true
if this context contains a attribute for the specified name.
-
hasFieldAttributeByName
Returnstrue
if the context has the value to which the specified key is mapped, ornull
if this context contains no mapping for the key.- Specified by:
hasFieldAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
fieldName
- the name of the field whose associated attribute to be determined.attributeName
- the name whose associated attribute to be determined.- Returns:
true
if the context has the value to which the specified key is mapped.
-
hasFieldByName
Returnstrue
if this context contains a field for the specified name.- Specified by:
hasFieldByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- name the name whose associated field to be determined.- Returns:
true
if this context contains a field for the specified name.
-
hasRelationshipAttributeByName
Returnstrue
if the context has the value to which the specified key is mapped, ornull
if this context contains no mapping for the key.- Specified by:
hasRelationshipAttributeByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
relationshipName
- the name of the relationship whose associated attribute to be determined.attributeName
- the name whose associated attribute to be determined.- Returns:
true
if the context has the value to which the specified key is mapped.
-
hasRelationshipByName
Returnstrue
if this context contains a relationship for the specified name.- Specified by:
hasRelationshipByName
in interfaceObjectContext<Map.Entry<String,
Object>> - Parameters:
name
- name the name whose associated relationship to be determined.- Returns:
true
if this context contains a relationship for the specified name.
-
pushCurrentTemplateName
-
popCurrentTemplateName
public void popCurrentTemplateName() -
getCurrentTemplateName
-
getTemplateNameStack
-
pushCurrentMacroName
-
popCurrentMacroName
public void popCurrentMacroName() -
getCurrentMacroName
-
getCurrentMacroCallDepth
public int getCurrentMacroCallDepth() -
getMacroNameStack
-
icacheGet
-
icachePut
-
setCurrentResource
-
getCurrentResource
-
setMacroLibraries
-
getMacroLibraries
-
attachEventCartridge
- Specified by:
attachEventCartridge
in interfaceInternalEventContext
-
getEventCartridge
- Specified by:
getEventCartridge
in interfaceInternalEventContext
-