Package com.linecorp.centraldogma.common
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 prettified textual representation of the specified content.Returns the textual representation of the specified content.boolean
boolean
Returns if thisEntry
has content, which is alwaystrue
if it's not a directory.int
hashCode()
void
ifHasContent
(Consumer<? super T> consumer) static <T> Entry
<T> Returns a newly-createdEntry
.ofDirectory
(Revision revision, String path) Returns a newly-createdEntry
of a directory.Returns a newly-createdEntry
of a JSON file.Returns a newly-createdEntry
of a JSON file.Returns a newly-createdEntry
of a text file.path()
Returns the path of thisEntry
.revision()
Returns the revision of thisEntry
.toString()
type()
Returns theEntryType
of the content.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.centraldogma.common.ContentHolder
contentAsJson, contentAsJson
-
Method Details
-
ofDirectory
Returns a newly-createdEntry
of a directory.- Parameters:
revision
- the revision of the directorypath
- the path of the directory
-
ofJson
Returns a newly-createdEntry
of a JSON file.- Parameters:
revision
- the revision of the JSON filepath
- the path of the JSON filecontent
- the content of the JSON file
-
ofJson
public static Entry<JsonNode> ofJson(Revision revision, String path, String content) throws JsonParseException Returns a newly-createdEntry
of 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 thecontent
is not a valid JSON
-
ofText
Returns a newly-createdEntry
of a text file.- Parameters:
revision
- the revision of the text filepath
- the path of the text filecontent
- the content of the text file
-
of
Returns a newly-createdEntry
. -
revision
Returns the revision of thisEntry
. -
path
Returns the path of thisEntry
. -
hasContent
public boolean hasContent()Returns if thisEntry
has content, which is alwaystrue
if it's not a directory. -
ifHasContent
-
type
Description copied from interface:ContentHolder
Returns theEntryType
of the content.- Specified by:
type
in interfaceContentHolder<T>
-
content
Description copied from interface:ContentHolder
Returns the content.- Specified by:
content
in interfaceContentHolder<T>
-
contentAsText
Description copied from interface:ContentHolder
Returns the textual representation of the specified content.- Specified by:
contentAsText
in interfaceContentHolder<T>
-
contentAsPrettyText
Description copied from interface:ContentHolder
Returns the prettified textual representation of the specified content. Only aTreeNode
is prettified currently.- Specified by:
contentAsPrettyText
in interfaceContentHolder<T>
-
hashCode
public int hashCode() -
equals
-
toString
-