From c3584b65814941a982519d8166b1ff661d48ea56 Mon Sep 17 00:00:00 2001 From: Kasper Jeppe Jeppesen Date: Wed, 15 Feb 2017 11:28:56 -0800 Subject: [PATCH] add getType to LazyElement --- build.gradle | 5 ++--- src/main/java/me/doubledutch/lazyjson/LazyArray.java | 9 +++++++++ src/main/java/me/doubledutch/lazyjson/LazyElement.java | 4 +++- src/main/java/me/doubledutch/lazyjson/LazyObject.java | 10 ++++++++++ src/main/resources/lazyjson_version.properties | 8 ++++---- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index e1f9ba2..f245b7f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -version = '1.2.6' +version = '1.2.7' group = "me.doubledutch" archivesBaseName = "lazyjson" @@ -83,7 +83,7 @@ jar { attributes 'Implementation-Title': 'LazyJSON Library', 'Implementation-Version': version } } -/* + uploadArchives { repositories { mavenDeployer { @@ -129,4 +129,3 @@ uploadArchives { } } } -*/ \ No newline at end of file diff --git a/src/main/java/me/doubledutch/lazyjson/LazyArray.java b/src/main/java/me/doubledutch/lazyjson/LazyArray.java index 3f4f20a..484ffc6 100644 --- a/src/main/java/me/doubledutch/lazyjson/LazyArray.java +++ b/src/main/java/me/doubledutch/lazyjson/LazyArray.java @@ -28,6 +28,15 @@ protected LazyArray(LazyNode root,char[] source){ super(root,source); } + /** + * Returns the type of this element. + * + * @return LazyType.ARRAY + */ + public LazyType getType(){ + return LazyType.ARRAY; + } + /** * Returns the value type of the given field. * diff --git a/src/main/java/me/doubledutch/lazyjson/LazyElement.java b/src/main/java/me/doubledutch/lazyjson/LazyElement.java index 64fe7d2..a4c7018 100644 --- a/src/main/java/me/doubledutch/lazyjson/LazyElement.java +++ b/src/main/java/me/doubledutch/lazyjson/LazyElement.java @@ -4,7 +4,7 @@ import java.nio.ByteBuffer; import java.nio.BufferOverflowException; -public class LazyElement{ +public abstract class LazyElement{ protected LazyNode root; protected char[] cbuf; @@ -31,6 +31,8 @@ public Template extractTemplate(){ return t; } + public abstract LazyType getType(); + public void writeTemplateValues(ByteBuffer buf,DictionaryCache dict) throws BufferOverflowException{ root.writeSegmentValues(cbuf,buf,dict); } diff --git a/src/main/java/me/doubledutch/lazyjson/LazyObject.java b/src/main/java/me/doubledutch/lazyjson/LazyObject.java index 9925717..34c4bc8 100644 --- a/src/main/java/me/doubledutch/lazyjson/LazyObject.java +++ b/src/main/java/me/doubledutch/lazyjson/LazyObject.java @@ -32,6 +32,16 @@ protected LazyObject(LazyNode root,char[] source){ super(root,source); } + + /** + * Returns the type of this element. + * + * @return LazyType.OBJECT + */ + public LazyType getType(){ + return LazyType.OBJECT; + } + /** * Returns the value type of the given field. * diff --git a/src/main/resources/lazyjson_version.properties b/src/main/resources/lazyjson_version.properties index a05bdcb..0002a8f 100644 --- a/src/main/resources/lazyjson_version.properties +++ b/src/main/resources/lazyjson_version.properties @@ -1,4 +1,4 @@ -#Wed Jan 25 14:12:37 PST 2017 -BUILD_VERSION=1.2.6 -BUILD_DATE=2017-01-25T22\:12\:37Z -BUILD_NUMBER=669 +#Wed Feb 15 11:28:09 PST 2017 +BUILD_VERSION=1.2.7 +BUILD_DATE=2017-02-15T19\:28\:09Z +BUILD_NUMBER=673