-
Notifications
You must be signed in to change notification settings - Fork 325
#259: Rename data access methods #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b18aecf
#259: Rename data access methods
xerial 31d2fe8
Fix Value#toJson
frsyuki d00a257
Merge pull request #2 from msgpack/fix-to-json
xerial 54029af
Use RawValue#toString instead of Value#toJson in MessagePackParser
komamitsu 641dacd
Merge pull request #3 from komamitsu/rename-dataaccess-fix-jackson
xerial File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,10 +186,16 @@ public int hashCode() | |
| return Variable.this.hashCode(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toJson() | ||
| { | ||
| return Variable.this.toJson(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() | ||
| { | ||
| return Variable.this.toString(); | ||
| return toJson(); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -357,7 +363,7 @@ public NumberValue asNumberValue() | |
| } | ||
|
|
||
| @Override | ||
| public byte castAsByte() | ||
| public byte toByte() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return ((BigInteger) objectValue).byteValue(); | ||
|
|
@@ -366,7 +372,7 @@ public byte castAsByte() | |
| } | ||
|
|
||
| @Override | ||
| public short castAsShort() | ||
| public short toShort() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return ((BigInteger) objectValue).shortValue(); | ||
|
|
@@ -375,7 +381,7 @@ public short castAsShort() | |
| } | ||
|
|
||
| @Override | ||
| public int castAsInt() | ||
| public int toInt() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return ((BigInteger) objectValue).intValue(); | ||
|
|
@@ -384,7 +390,7 @@ public int castAsInt() | |
| } | ||
|
|
||
| @Override | ||
| public long castAsLong() | ||
| public long toLong() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return ((BigInteger) objectValue).longValue(); | ||
|
|
@@ -393,7 +399,7 @@ public long castAsLong() | |
| } | ||
|
|
||
| @Override | ||
| public BigInteger castAsBigInteger() | ||
| public BigInteger toBigInteger() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return (BigInteger) objectValue; | ||
|
|
@@ -405,7 +411,7 @@ else if (type == Type.DOUBLE) { | |
| } | ||
|
|
||
| @Override | ||
| public float castAsFloat() | ||
| public float toFloat() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return ((BigInteger) objectValue).floatValue(); | ||
|
|
@@ -417,7 +423,7 @@ else if (type == Type.DOUBLE) { | |
| } | ||
|
|
||
| @Override | ||
| public double castAsDouble() | ||
| public double toDouble() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return ((BigInteger) objectValue).doubleValue(); | ||
|
|
@@ -524,7 +530,7 @@ public MessageFormat mostSuccinctMessageFormat() | |
| } | ||
|
|
||
| @Override | ||
| public byte getByte() | ||
| public byte asByte() | ||
| { | ||
| if (!isInByteRange()) { | ||
| throw new MessageIntegerOverflowException(longValue); | ||
|
|
@@ -533,7 +539,7 @@ public byte getByte() | |
| } | ||
|
|
||
| @Override | ||
| public short getShort() | ||
| public short asShort() | ||
| { | ||
| if (!isInByteRange()) { | ||
| throw new MessageIntegerOverflowException(longValue); | ||
|
|
@@ -542,7 +548,7 @@ public short getShort() | |
| } | ||
|
|
||
| @Override | ||
| public int getInt() | ||
| public int asInt() | ||
| { | ||
| if (!isInIntRange()) { | ||
| throw new MessageIntegerOverflowException(longValue); | ||
|
|
@@ -551,7 +557,7 @@ public int getInt() | |
| } | ||
|
|
||
| @Override | ||
| public long getLong() | ||
| public long asLong() | ||
| { | ||
| if (!isInLongRange()) { | ||
| throw new MessageIntegerOverflowException(longValue); | ||
|
|
@@ -560,7 +566,7 @@ public long getLong() | |
| } | ||
|
|
||
| @Override | ||
| public BigInteger getBigInteger() | ||
| public BigInteger asBigInteger() | ||
| { | ||
| if (type == Type.BIG_INTEGER) { | ||
| return (BigInteger) objectValue; | ||
|
|
@@ -592,15 +598,15 @@ public Variable setFloatValue(double v) | |
| this.type = Type.DOUBLE; | ||
| this.accessor = floatAccessor; | ||
| this.doubleValue = v; | ||
| this.longValue = (long) v; // AbstractNumberValueAccessor uses castAsLong | ||
| this.longValue = (long) v; // AbstractNumberValueAccessor uses toLong | ||
| return this; | ||
| } | ||
|
|
||
| public Variable setFloatValue(float v) | ||
| { | ||
| this.type = Type.DOUBLE; | ||
| this.accessor = floatAccessor; | ||
| this.longValue = (long) v; // AbstractNumberValueAccessor uses castAsLong | ||
| this.longValue = (long) v; // AbstractNumberValueAccessor uses toLong | ||
| return this; | ||
| } | ||
|
|
||
|
|
@@ -651,19 +657,19 @@ public RawValue asRawValue() | |
| } | ||
|
|
||
| @Override | ||
| public byte[] getByteArray() | ||
| public byte[] asByteArray() | ||
| { | ||
| return (byte[]) objectValue; | ||
| } | ||
|
|
||
| @Override | ||
| public ByteBuffer getByteBuffer() | ||
| public ByteBuffer asByteBuffer() | ||
| { | ||
| return ByteBuffer.wrap(getByteArray()); | ||
| return ByteBuffer.wrap(asByteArray()); | ||
| } | ||
|
|
||
| @Override | ||
| public String getString() | ||
| public String asString() | ||
| { | ||
| byte[] raw = (byte[]) objectValue; | ||
| try { | ||
|
|
@@ -678,7 +684,7 @@ public String getString() | |
| } | ||
|
|
||
| @Override | ||
| public String stringValue() | ||
| public String toJson() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this |
||
| { | ||
| byte[] raw = (byte[]) objectValue; | ||
| try { | ||
|
|
@@ -724,7 +730,7 @@ public BinaryValue asBinaryValue() | |
| @Override | ||
| public ImmutableBinaryValue immutableValue() | ||
| { | ||
| return ValueFactory.newBinary(getByteArray()); | ||
| return ValueFactory.newBinary(asByteArray()); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -1044,11 +1050,17 @@ public boolean equals(Object o) | |
| } | ||
|
|
||
| @Override | ||
| public String toString() | ||
| public String toJson() | ||
| { | ||
| return immutableValue().toString(); // TODO optimize | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() | ||
| { | ||
| return toJson(); | ||
| } | ||
|
|
||
| @Override | ||
| public ValueType getValueType() | ||
| { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean
Variable.this.toString();?