/** * Returns the {@link RevisionRange} whose major value of {@code from} {@link Revision} is lower than * or equal to the major value of {@code to} {@link Revision}. * * @throws IllegalStateException if the {@code from} and {@code to} {@link Revision}s are in the * different state. They should be either absolute or relative. */ public RevisionRange toAscending() { if (isAscending() || from.equals(to)) { return this; } return new RevisionRange(to, from); }
/** * Returns a newly-created {@link Query} that retrieves the textual content as it is. * * @param path the path of a file being queried on */ static Query<String> ofText(String path) { return new IdentityQuery<>(path); }
/** * Creates a new instance. */ public EntryNotFoundException(Revision revision, String path) { this(path + " (revision: " + revision.text() + ')'); }
/** * Returns a newly-created {@link Query} that applies a series of * <a href="https://github.com/json-path/JsonPath/blob/master/README.md">JSON path expressions</a> * to the content. * * @param path the path of a file being queried on * @param jsonPaths the JSON path expressions to apply */ static Query<JsonNode> ofJsonPath(String path, String... jsonPaths) { return new JsonPathQuery(path, jsonPaths); }
/** * Returns a newly-created {@link Entry} of a directory. * * @param revision the revision of the directory * @param path the path of the directory */ public static Entry<Void> ofDirectory(Revision revision, String path) { return new Entry<>(revision, path, EntryType.DIRECTORY, null); }
/** * Returns a newly-created {@link Change} whose type is {@link ChangeType#REMOVE}. * * @param path the path of the file to remove */ static Change<Void> ofRemoval(String path) { return new DefaultChange<>(path, ChangeType.REMOVE, null); }
@Override public String contentAsText() { if (contentAsText == null) { contentAsText = ContentHolder.super.contentAsText(); } return contentAsText; }
@Override public String contentAsPrettyText() { if (contentAsPrettyText == null) { contentAsPrettyText = ContentHolder.super.contentAsPrettyText(); } return contentAsPrettyText; }
/** * Returns a newly-created {@link MergeSource} which contains an optional path. */ public static MergeSource ofOptional(String path) { return new MergeSource(path, true); }
/** * Returns the {@link RevisionRange} whose major value of {@code from} {@link Revision} is lower than * or equal to the major value of {@code to} {@link Revision}. * * @throws IllegalStateException if the {@code from} and {@code to} {@link Revision}s are in the * different state. They should be either absolute or relative. */ public RevisionRange toAscending() { if (isAscending() || from.equals(to)) { return this; } return new RevisionRange(to, from); }
/** * Returns a newly-created {@link Query} that applies a series of * <a href="https://github.com/json-path/JsonPath/blob/master/README.md">JSON path expressions</a> * to the content. * * @param path the path of a file being queried on * @param jsonPaths the JSON path expressions to apply */ static Query<JsonNode> ofJsonPath(String path, String... jsonPaths) { return new JsonPathQuery(path, jsonPaths); }
@Override public String contentAsText() { if (contentAsText == null) { contentAsText = ContentHolder.super.contentAsText(); } return contentAsText; }
@Override public String contentAsPrettyText() { if (contentAsPrettyText == null) { contentAsPrettyText = ContentHolder.super.contentAsPrettyText(); } return contentAsPrettyText; }
/** * Returns the {@link RevisionRange} whose major value of {@code from} {@link Revision} is lower than * or equal to the major value of {@code to} {@link Revision}. * * @throws IllegalStateException if the {@code from} and {@code to} {@link Revision}s are in the * different state. They should be either absolute or relative. */ public RevisionRange toAscending() { if (isAscending() || from.equals(to)) { return this; } return new RevisionRange(to, from); }