Class 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 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

      public Object getAttributeByName(String name)
      Returns the attribute to which the specified name is mapped, or null if this context contains no mapping for the name.
      Specified by:
      getAttributeByName in interface ObjectContext<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

      public Object 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.
      Specified by:
      getAttributeByName in interface ObjectContext<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

      public Map<String,Object> getAttributes()
      Returns all attributes of this context.
      Specified by:
      getAttributes in interface ObjectContext<Map.Entry<String,Object>>
      Returns:
      all attributes of this context.
    • getFieldAttributeByName

      public Object getFieldAttributeByName(String fieldName, String attributeName)
      Returns the attribute for a field by the name of the field and attribute.
      Specified by:
      getFieldAttributeByName in interface ObjectContext<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

      public Object 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.
      Specified by:
      getFieldAttributeByName in interface ObjectContext<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

      public Object getFieldByName(String name)
      Returns the field of this context by the name of the field.
      Specified by:
      getFieldByName in interface ObjectContext<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

      public Map<String,Object> getFields()
      Returns all fields of this context.
      Specified by:
      getFields in interface ObjectContext<Map.Entry<String,Object>>
      Returns:
      all fields of this context.
    • getRelationshipAttributeByName

      public Object getRelationshipAttributeByName(String relationshipName, String attributeName)
      Returns the attribute for a relationship by the name of the relationship and attribute.
      Specified by:
      getRelationshipAttributeByName in interface ObjectContext<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 interface ObjectContext<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

      public Object getRelationshipByName(String name)
      Returns the relationship of this context by the name of the relationship.
      Specified by:
      getRelationshipByName in interface ObjectContext<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

      public Map<String,Object> getRelationships()
      Returns all relationship of this context.
      Specified by:
      getRelationships in interface ObjectContext<Map.Entry<String,Object>>
      Returns:
      all relationship of this context.
    • hasAttributeByName

      public boolean hasAttributeByName(String name)
      Returns true if this context contains a attribute for the specified name.
      Specified by:
      hasAttributeByName in interface ObjectContext<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

      public boolean hasFieldAttributeByName(String fieldName, String attributeName)
      Returns true if the context has the value to which the specified key is mapped, or null if this context contains no mapping for the key.
      Specified by:
      hasFieldAttributeByName in interface ObjectContext<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

      public boolean hasFieldByName(String name)
      Returns true if this context contains a field for the specified name.
      Specified by:
      hasFieldByName in interface ObjectContext<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

      public boolean hasRelationshipAttributeByName(String relationshipName, String attributeName)
      Returns true if the context has the value to which the specified key is mapped, or null if this context contains no mapping for the key.
      Specified by:
      hasRelationshipAttributeByName in interface ObjectContext<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

      public boolean hasRelationshipByName(String name)
      Returns true if this context contains a relationship for the specified name.
      Specified by:
      hasRelationshipByName in interface ObjectContext<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

      public void pushCurrentTemplateName(String arg0)
    • popCurrentTemplateName

      public void popCurrentTemplateName()
    • getCurrentTemplateName

      public String getCurrentTemplateName()
    • getTemplateNameStack

      public String[] getTemplateNameStack()
    • pushCurrentMacroName

      public void pushCurrentMacroName(String arg0)
    • popCurrentMacroName

      public void popCurrentMacroName()
    • getCurrentMacroName

      public String getCurrentMacroName()
    • getCurrentMacroCallDepth

      public int getCurrentMacroCallDepth()
    • getMacroNameStack

      public String[] getMacroNameStack()
    • icacheGet

      public IntrospectionCacheData icacheGet(Object arg0)
    • icachePut

      public void icachePut(Object arg0, IntrospectionCacheData arg1)
    • setCurrentResource

      public void setCurrentResource(Resource arg0)
    • getCurrentResource

      public Resource getCurrentResource()
    • setMacroLibraries

      public void setMacroLibraries(List<Template> arg0)
    • getMacroLibraries

      public List<Template> getMacroLibraries()
    • attachEventCartridge

      public EventCartridge attachEventCartridge(EventCartridge arg0)
      Specified by:
      attachEventCartridge in interface InternalEventContext
    • getEventCartridge

      public EventCartridge getEventCartridge()
      Specified by:
      getEventCartridge in interface InternalEventContext