diff --git a/src/main/java/com/github/dgroup/velocity/path/PathOf.java b/src/main/java/com/github/dgroup/velocity/path/PathOf.java index a490bff..82ad0ae 100644 --- a/src/main/java/com/github/dgroup/velocity/path/PathOf.java +++ b/src/main/java/com/github/dgroup/velocity/path/PathOf.java @@ -28,14 +28,14 @@ import java.text.MessageFormat; import org.cactoos.Scalar; import org.cactoos.Text; -import org.cactoos.scalar.UncheckedScalar; +import org.cactoos.text.UncheckedText; /** * The path to the resource. * * @since 0.1.0 */ -public final class PathOf implements Scalar { +public final class PathOf implements Scalar, Text { /** * The path. @@ -83,9 +83,11 @@ public Path value() throws Exception { @Override public String toString() { - return new UncheckedScalar<>(this) - .value() - .toAbsolutePath() - .toString(); + return new UncheckedText((Text) this).asString(); + } + + @Override + public String asString() throws Exception { + return this.value().toAbsolutePath().toString(); } } diff --git a/src/main/java/com/github/dgroup/velocity/path/RelativePath.java b/src/main/java/com/github/dgroup/velocity/path/RelativePath.java index 09b8dea..e3d6add 100644 --- a/src/main/java/com/github/dgroup/velocity/path/RelativePath.java +++ b/src/main/java/com/github/dgroup/velocity/path/RelativePath.java @@ -28,7 +28,7 @@ import java.text.MessageFormat; import org.cactoos.Scalar; import org.cactoos.Text; -import org.cactoos.scalar.UncheckedScalar; +import org.cactoos.text.UncheckedText; /** * Relative path. @@ -37,7 +37,7 @@ * * @since 0.2 */ -public final class RelativePath implements Scalar { +public final class RelativePath implements Scalar, Text { /** * The relative path. @@ -85,7 +85,7 @@ public String value() throws Exception { @Override public String toString() { - return new UncheckedScalar<>(this).value(); + return new UncheckedText((Text)this).asString(); } /** @@ -93,7 +93,11 @@ public String toString() { * @return The path. */ public Scalar toPath() { - return () -> Paths.get(this.toString()); + return () -> Paths.get(this.asString()); } + @Override + public String asString() throws Exception { + return this.value(); + } }