You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by st...@apache.org on 2018/02/28 23:54:58 UTC
[4/9] commons-rdf git commit: Parsed() drops count()
Parsed() drops count()
adds a bean implementation
Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/91242705
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/91242705
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/91242705
Branch: refs/heads/fluent-parser-impl
Commit: 912427059e1932ae614ec9c6ffd5c4e18298c78c
Parents: db99ef1
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Wed Feb 28 23:39:29 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Wed Feb 28 23:39:29 2018 +0000
----------------------------------------------------------------------
.../org/apache/commons/rdf/api/io/Parsed.java | 36 +++++++++++++++++---
1 file changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/91242705/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Parsed.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Parsed.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Parsed.java
index b252e44..12640dc 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Parsed.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Parsed.java
@@ -17,10 +17,36 @@
*/
package org.apache.commons.rdf.api.io;
-public interface Parsed<T, S> {
- long count();
+public interface Parsed<S, T> {
- ParserSource<S> from();
+ ParserSource<S> from();
- ParserTarget<T> into();
-}
\ No newline at end of file
+ ParserTarget<T> into();
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public static <S, T> Parsed<S, T> from(
+ final ParserSource<S> from,
+ final ParserTarget<T> into) {
+ return new ParsedImpl(from, into);
+ }
+}
+
+class ParsedImpl<S, T> implements Parsed<S, T> {
+ private ParserSource<S> from;
+ private ParserTarget<T> into;
+
+ ParsedImpl(final ParserSource<S> from, final ParserTarget<T> into) {
+ this.from = from;
+ this.into = into;
+ }
+
+ @Override
+ public ParserSource<S> from() {
+ return from;
+ }
+
+ @Override
+ public ParserTarget<T> into() {
+ return into;
+ }
+}