Interface JsonGenerationContext


@NonExtendable @Experimental public interface JsonGenerationContext
Interface representing a specialized version of the GenerationContext for json.The JsonGenerationContext is used to hold and distribute all information regarding the rendering of a JSON document.
CAUTION: This class is still in development and may change drastically without any further notice.
Since:
5.2.191206
  • Method Details

    • handle

      @NotNull <T> @NotNull JsonElement<?> handle(@Nullable T object)
      Entry point for the transformation of an object to a JsonElement. If eligible, the transformation will also include dependent objects in a hierarchical manner and potentially include form data, meta data, bodies, sections and template informationof FirstSpirit objects.
      Type Parameters:
      T - the type of the given object
      Parameters:
      object - the object to transform to json
      Returns:
      the transformed JsonElement
      Since:
      5.2.191206
    • getLogger

      @NotNull @NotNull JsonGenerationContext.JsonLogger getLogger()
      Returns:
      the current JsonGenerationContext.JsonLogger
      Since:
      5.2.191206
      See Also:
    • setAttribute

      <O> void setAttribute(@NotNull @NotNull String name, @Nullable O value)
      Sets the given value in the this context. The values will be stored in a stack which will automatically get pushed/popped when rendering hierarchical objects. The given name will be used as an unique identifierfor the current attribute stack. Using the same name on the same stack will result in overwriting the value in the current context.
      Type Parameters:
      O - the type of the given value
      Parameters:
      name - the name of the value, must be unique
      value - the value to set in this context
      Since:
      5.2.191206
      See Also:
    • getAttribute

      @NotNull <O> @NotNull Optional<O> getAttribute(@NotNull @NotNull String name)
      Lookup an attribute with the given name in the current stack. If the value is not present in the current stack, this method willtry to find it in all stacks below the current one and return the first occurrence. If no occurrence is found, an empty Optionalwill be returned.
      Type Parameters:
      O - the type of the value to lookup
      Parameters:
      name - the name of the attribute to lookup
      Returns:
      the first occurrence of the attribute with the given name as an Optional
      Since:
      5.2.191206
      See Also:
    • isRelease

      boolean isRelease()
      Indicates whether this context is based on a release version.
      Returns:
      true this context is based on a release version
      Since:
      5.2.191206
      See Also:
    • getLanguage

      @Nullable @Nullable Language getLanguage()
      Returns the current Language of this generation context.
      Returns:
      the current Language
      Since:
      5.2.191206
      See Also:
    • getSettings

      @NotNull @NotNull JsonSettings getSettings()
      Returns the current json settings of this generation context.
      Returns:
      the current json settings o
      Since:
      5.2.191206
      See Also: