Class Entry<T>
java.lang.Object
com.linecorp.centraldogma.common.Entry<T>
- All Implemented Interfaces:
ContentHolder<T>
A file or a directory in a repository.
-
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the content.Returns the JSON representation of the specified content.Returns the prettified textual representation of the specified content.Returns the textual representation of the specified content.booleanbooleanReturns if thisEntryhas content, which is alwaystrueif it's not a directory.inthashCode()voidifHasContent(Consumer<? super T> consumer) static <T> Entry<T> Returns a newly-createdEntry.static <T> Entry<T> of(Revision revision, String path, EntryType type, @Nullable T content, @Nullable Revision templateRevision) Returns a newly-createdEntry.ofDirectory(Revision revision, String path) Returns a newly-createdEntryof a directory.Returns a newly-createdEntryof a JSON file.Returns a newly-createdEntryof a JSON file.Returns a newly-createdEntryof a text file.Returns a newly-createdEntryof a YAML file with the given content.Returns a newly-createdEntryof a YAML file.path()Returns the path of thisEntry.@Nullable StringReturns the raw content if available.revision()Returns the revision of thisEntry.@Nullable RevisionReturns the revision of the template variables that were used to render the template and generate thisEntry.toString()type()Returns theEntryTypeof the content.withTemplateRevision(Revision templateRevision) Sets the revision of the template variables that were used to render the template and generate thisEntry.Methods inherited from interface ContentHolder
contentAsJson
-
Method Details
-
ofDirectory
-
ofJson
-
ofJson
public static Entry<JsonNode> ofJson(Revision revision, String path, String content) throws JsonParseException Returns a newly-createdEntryof a JSON file.- Parameters:
revision- the revision of the JSON filepath- the path of the JSON filecontent- the content of the JSON file- Throws:
JsonParseException- if thecontentis not a valid JSON
-
ofYaml
-
ofYaml
public static Entry<JsonNode> ofYaml(Revision revision, String path, String content) throws JsonProcessingException Returns a newly-createdEntryof a YAML file.- Parameters:
revision- the revision of the YAML filepath- the path of the YAML filecontent- the content of the YAML file- Throws:
JsonProcessingException- if thecontentis not a valid YAML
-
ofText
-
of
Returns a newly-createdEntry. -
of
public static <T> Entry<T> of(Revision revision, String path, EntryType type, @Nullable T content, @Nullable Revision templateRevision) Returns a newly-createdEntry.- Type Parameters:
T- the content type.JsonNodeif JSON.Stringif text.- Parameters:
revision- the revision of theEntrypath- the path of theEntrytype- the type of theEntrycontent- the content of theEntrytemplateRevision- the revision of the variables that were used to render the template and generate thisEntry
-
revision
-
templateRevision
-
withTemplateRevision
-
path
-
hasContent
public boolean hasContent()Returns if thisEntryhas content, which is alwaystrueif it's not a directory. -
ifHasContent
-
type
Description copied from interface:ContentHolderReturns theEntryTypeof the content.- Specified by:
typein interfaceContentHolder<T>
-
content
Description copied from interface:ContentHolderReturns the content.- Specified by:
contentin interfaceContentHolder<T>
-
rawContent
Returns the raw content if available. -
contentAsText
Description copied from interface:ContentHolderReturns the textual representation of the specified content.- Specified by:
contentAsTextin interfaceContentHolder<T>
-
contentAsPrettyText
Description copied from interface:ContentHolderReturns the prettified textual representation of the specified content. Only aTreeNodeis prettified currently.- Specified by:
contentAsPrettyTextin interfaceContentHolder<T>
-
contentAsJson
Description copied from interface:ContentHolderReturns the JSON representation of the specified content.- Specified by:
contentAsJsonin interfaceContentHolder<T>- Returns:
- the
JsonNodeparsed from the content - Throws:
JsonParseException- if failed to parse the content as JSON
-
hashCode
-
equals
-
toString
-