commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wik...@apache.org
Subject [17/50] [abbrv] incubator-commonsrdf git commit: Check for datatype IRIs in Types inside of LiteralImpl constructor
Date Fri, 27 Mar 2015 18:15:15 GMT
Check for datatype IRIs in Types inside of LiteralImpl constructor

Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/79eabd39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/79eabd39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/79eabd39

Branch: refs/heads/master
Commit: 79eabd396d046ab1ae8a41f769195e911964ed8a
Parents: 424770c
Author: Peter Ansell <p_ansell@yahoo.com>
Authored: Mon Jan 26 18:08:41 2015 +1100
Committer: Peter Ansell <p_ansell@yahoo.com>
Committed: Mon Jan 26 18:08:41 2015 +1100

----------------------------------------------------------------------
 .../main/java/com/github/commonsrdf/simple/LiteralImpl.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/79eabd39/simple/src/main/java/com/github/commonsrdf/simple/LiteralImpl.java
----------------------------------------------------------------------
diff --git a/simple/src/main/java/com/github/commonsrdf/simple/LiteralImpl.java b/simple/src/main/java/com/github/commonsrdf/simple/LiteralImpl.java
index 04bb454..059f153 100644
--- a/simple/src/main/java/com/github/commonsrdf/simple/LiteralImpl.java
+++ b/simple/src/main/java/com/github/commonsrdf/simple/LiteralImpl.java
@@ -34,14 +34,13 @@ class LiteralImpl implements Literal {
 	private String lexicalForm;
 
 	public LiteralImpl(String literal) {
-		this.lexicalForm = Objects.requireNonNull(literal);
-		this.dataType = Types.XSD_STRING;
-		this.languageTag = Optional.empty();
+		this(literal, Types.XSD_STRING);
 	}
 
 	public LiteralImpl(String lexicalForm, IRI dataType) {
 		this.lexicalForm = Objects.requireNonNull(lexicalForm);
-		this.dataType = Objects.requireNonNull(dataType);
+		this.dataType = Types.get(Objects.requireNonNull(dataType)).orElse(
+				dataType);
 		this.languageTag = Optional.empty();
 	}
 


Mime
View raw message