You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by wi...@apache.org on 2015/03/27 19:15:15 UTC

[17/50] [abbrv] incubator-commonsrdf git commit: Check for datatype IRIs in Types inside of LiteralImpl constructor

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_...@yahoo.com>
Authored: Mon Jan 26 18:08:41 2015 +1100
Committer: Peter Ansell <p_...@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();
 	}