Package com.linecorp.centraldogma.common
Interface ContentHolder<T>
- Type Parameters:
T
- the type of the content
- All Known Implementing Classes:
Entry
,MergedEntry
public interface ContentHolder<T>
A holder which has the content and its
EntryType
.-
Method Summary
Modifier and TypeMethodDescriptioncontent()
Returns the content.default JsonNode
Returns the JSON representation of the specified content.default <U> U
contentAsJson
(Class<U> valueType) Returns the value converted from the JSON representation of the specified content.default String
Returns the prettified textual representation of the specified content.default String
Returns the textual representation of the specified content.type()
Returns theEntryType
of the content.
-
Method Details
-
type
EntryType type()Returns theEntryType
of the content. -
content
T content()Returns the content.- Throws:
IllegalStateException
- if the content isnull
-
contentAsText
Returns the textual representation of the specified content.- Throws:
IllegalStateException
- if the content isnull
-
contentAsPrettyText
Returns the prettified textual representation of the specified content. Only aTreeNode
is prettified currently.- Throws:
IllegalStateException
- if the content isnull
-
contentAsJson
Returns the JSON representation of the specified content.- Returns:
- the
JsonNode
parsed from the content - Throws:
IllegalStateException
- if the content isnull
JsonParseException
- if failed to parse the content as JSON
-
contentAsJson
Returns the value converted from the JSON representation of the specified content.- Returns:
- the value converted from the content
- Throws:
IllegalStateException
- if the content isnull
JsonParseException
- if failed to parse the content as JSONJsonMappingException
- if failed to convert the parsed JSON intovalueType
-