Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e2fc4e6
Renmae ExtendedType -> ExtensionType
xerial Jun 13, 2015
bc7e503
ValueFactory.newXXXValue -> newXXX for brevity
xerial Jun 13, 2015
b123089
immutableValue() -> toImmutable()
xerial Jun 13, 2015
4bcfab5
Add visitor interface
xerial Jun 13, 2015
de6d1f5
Add augumented constructor for ExtensionTypeHeader
xerial Jun 13, 2015
04819a3
Fix test case
xerial Jun 13, 2015
d1807a5
Add ValueType bit mask to improve type check performance
xerial Jun 13, 2015
770f013
Preserve float and double differences
xerial Jun 13, 2015
775379d
Renamed xxxValue that returns primitive type value as toXXX
xerial Jun 13, 2015
301ae10
Remove public scope from interface
xerial Jun 13, 2015
9db3537
Fix compilation error of msgpack-jackson
xerial Jun 13, 2015
c782451
toImmutable -> immutableValue
xerial Jun 15, 2015
ed45331
Remove visitor, ExtensionTypeHeader constructor. Fix exception type o…
xerial Jun 15, 2015
787533c
Remove ValueFactory.newArrayOf
xerial Jun 15, 2015
53557e9
Removed ValueType.bitMask
xerial Jun 15, 2015
9e8c806
Fix test compile error
xerial Jun 15, 2015
33f9ccf
Changed the extension type interface to use byte
xerial Jun 15, 2015
3df8f36
FloatHolder test is no longer necesary
xerial Jun 15, 2015
5289289
Remove RawValue
xerial Jun 15, 2015
4cba605
Fix test case that checks nil value
xerial Jun 15, 2015
c14c87c
Fix test cases and range check of extension types
xerial Jun 15, 2015
f6f9e8f
Fixes test case to use getString to extract raw string value
xerial Jun 15, 2015
e1b8105
Removed obsolete classes
xerial Jun 15, 2015
1d1da11
Moved example codes to test folder
xerial Jun 15, 2015
005edf4
Map.Entry based builder. Add putAll methods
xerial Jun 16, 2015
bef3c55
nil() -> newNil() for method name consisitency
xerial Jun 16, 2015
ca2fb1e
Add comment to ExtensionTypeHeader
xerial Jun 16, 2015
5ba7366
Fix unit test errors
komamitsu Jun 18, 2015
080deb3
Merge pull request #1 from komamitsu/v07-value-impl-rev2-fix-jackson-…
xerial Jun 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove public scope from interface
  • Loading branch information
xerial committed Jun 13, 2015
commit 301ae108cbff746f6f63d6bb0303882b261a4c74
12 changes: 5 additions & 7 deletions msgpack-core/src/main/java/org/msgpack/value/ArrayValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
* MessagePack's Array type can represent sequence of values.
*/
public interface ArrayValue extends Value, Iterable<Value> {
@Override
public ImmutableArrayValue toImmutable();

/**
* Returns number of elements in this array.
*/
public int size();
int size();

/**
* Returns the element at the specified position in this array.
Expand All @@ -39,21 +37,21 @@ public interface ArrayValue extends Value, Iterable<Value> {
* If the index is out of range
* (<tt>index &lt; 0 || index &gt;= size()</tt>)
*/
public Value get(int index);
Value get(int index);

/**
* Returns the element at the specified position in this array.
* This method returns an ImmutableNilValue if the index is out of range.
*/
public Value getOrNilValue(int index);
Value getOrNilValue(int index);

/**
* Returns an iterator over elements.
*/
public Iterator<Value> iterator();
Iterator<Value> iterator();

/**
* Returns the value as {@code List}.
*/
public List<Value> list();
List<Value> list();
}
2 changes: 0 additions & 2 deletions msgpack-core/src/main/java/org/msgpack/value/BinaryValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@
* @see org.msgpack.value.RawValue
*/
public interface BinaryValue extends RawValue {
@Override
public ImmutableBinaryValue toImmutable();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
* MessagePack's Boolean type can represent {@code true} or {@code false}.
*/
public interface BooleanValue extends Value {
@Override
public ImmutableBooleanValue toImmutable();

/**
* Returns the value as a {@code boolean}.
*/
public boolean getBoolean();
boolean getBoolean();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
* As the type information, applications can use 0 to 127 as the application-specific types. -1 to -128 is reserved for MessagePack's future extension.
*/
public interface ExtensionValue extends Value {
@Override
public ImmutableExtensionValue toImmutable();
byte getType();

public byte getType();

public byte[] getData();
byte[] getData();
}
2 changes: 0 additions & 2 deletions msgpack-core/src/main/java/org/msgpack/value/FloatValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@
* @see org.msgpack.value.NumberValue
*/
public interface FloatValue extends NumberValue {
@Override
public ImmutableFloatValue toImmutable();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public interface ImmutableArrayValue extends ArrayValue, ImmutableValue {
* Returns an iterator over elements.
* Returned Iterator does not support {@code remove()} method since the value is immutable.
*/
public Iterator<Value> iterator();
Iterator<Value> iterator();

/**
* Returns the value as {@code List}.
* Returned List is immutable. It does not support {@code put()}, {@code clear()}, or other methods that modify the value.
*/
public List<Value> list();
List<Value> list();
}
30 changes: 14 additions & 16 deletions msgpack-core/src/main/java/org/msgpack/value/IntegerValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,70 +16,68 @@
package org.msgpack.value;

import java.math.BigInteger;
import org.msgpack.core.MessageOverflowException;

/**
* The interface {@code IntegerValue} represents MessagePack's Integer type.
*
* MessagePack's Integer type can represent from -2<sup>63</sup> to 2<sup>64</sup>-1.
*/
public interface IntegerValue extends NumberValue {
@Override
public ImmutableIntegerValue toImmutable();

/**
* Returns true if the value is in the range of [-2<sup>7</sup> to 2<sup>7</sup>-1].
*/
public boolean isInByteRange();
boolean isInByteRange();

/**
* Returns true if the value is in the range of [-2<sup>15</sup> to 2<sup>15</sup>-1]
*/
public boolean isInShortRange();
boolean isInShortRange();

/**
* Returns true if the value is in the range of [-2<sup>31</sup> to 2<sup>31</sup>-1]
*/
public boolean isInIntRange();
boolean isInIntRange();

/**
* Returns true if the value is in the range of [-2<sup>63</sup> to 2<sup>63</sup>-1]
*/
public boolean isInLongRange();
boolean isInLongRange();

/**
* Returns the value as a {@code byte}, otherwise throws an exception.
*
* @throws MessageIntegerOverflowException
* @throws MessageOverflowException
* If the value does not fit in the range of {@code byte} type.
*/
public byte getByte();
byte getByte();

/**
* Returns the value as a {@code short}, otherwise throws an exception.
*
* @throws MessageIntegerOverflowException
* @throws MessageOverflowException
* If the value does not fit in the range of {@code short} type.
*/
public short getShort();
short getShort();

/**
* Returns the value as an {@code int}, otherwise throws an exception.
*
* @throws MessageIntegerOverflowException
* @throws MessageOverflowException
* If the value does not fit in the range of {@code int} type.
*/
public int getInt();
int getInt();

/**
* Returns the value as a {@code long}, otherwise throws an exception.
*
* @throws MessageIntegerOverflowException
* @throws MessageOverflowException
* If the value does not fit in the range of {@code long} type.
*/
public long getLong();
long getLong();

/**
* Returns the value as a {@code BigInteger}.
*/
public BigInteger getBigInteger();
BigInteger getBigInteger();
}
15 changes: 6 additions & 9 deletions msgpack-core/src/main/java/org/msgpack/value/MapValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,21 @@
* MessagePack's Map type can represent sequence of key-value pairs.
*/
public interface MapValue extends Value {
@Override
public ImmutableMapValue toImmutable();

/**
* Returns number of key-value pairs in this array.
*/
public int size();
int size();

public Set<Value> keySet();
Set<Value> keySet();

public Set<Map.Entry<Value, Value>> entrySet();
Set<Map.Entry<Value, Value>> entrySet();

public Collection<Value> values();
Collection<Value> values();

/**
* Returns the value as {@code Map}.
*/
public Map<Value, Value> map();
Map<Value, Value> map();

/**
* Returns the key-value pairs as an array of {@code Value}.
Expand All @@ -51,5 +48,5 @@ public interface MapValue extends Value {
*
* For example, if this value represents <code>{"k1": "v1", "k2": "v2"}</code>, this method returns ["k1", "v1", "k2", "v2"].
*/
public Value[] getKeyValueArray();
Value[] getKeyValueArray();
}
2 changes: 0 additions & 2 deletions msgpack-core/src/main/java/org/msgpack/value/NilValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@
* The interface {@code NilValue} represents MessagePack's Nil type.
*/
public interface NilValue extends Value {
@Override
public ImmutableNilValue toImmutable();
}
12 changes: 5 additions & 7 deletions msgpack-core/src/main/java/org/msgpack/value/RawValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.msgpack.value;

import java.nio.ByteBuffer;
import org.msgpack.core.MessageStringCodingException;

/**
* The interface {@code RawValue} represents MessagePack's Raw type, which means Binary or String type.
Expand All @@ -26,23 +27,20 @@
* @see org.msgpack.value.BinaryValue
*/
public interface RawValue extends Value {
@Override
public ImmutableRawValue toImmutable();

/**
* Returns the value as {@code byte[]}.
*
* This method copies the byte array.
*/
public byte[] getByteArray();
byte[] getByteArray();

/**
* Returns the value as {@code ByteBuffer}.
*
* Returned ByteBuffer is read-only. See {@code#asReadOnlyBuffer()}.
* This method doesn't copy the byte array as much as possible.
*/
public ByteBuffer getByteBuffer();
ByteBuffer getByteBuffer();

/**
* Returns the value as {@code String}.
Expand All @@ -52,12 +50,12 @@ public interface RawValue extends Value {
* @throws MessageStringCodingException
* If this value includes invalid UTF-8 byte sequence.
*/
public String getString();
String getString();

/**
* Returns the value as {@code String}.
*
* This method replaces an invalid UTF-8 byte sequence with <code>U+FFFD replacement character</code>.
*/
public String stringValue();
String stringValue();
}
2 changes: 0 additions & 2 deletions msgpack-core/src/main/java/org/msgpack/value/StringValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@
* @see org.msgpack.value.RawValue
*/
public interface StringValue extends RawValue {
@Override
public ImmutableStringValue toImmutable();
}