Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* The interface {@code ArrayValue} represents MessagePack's Array type.
* <p/>
*
* MessagePack's Array type can represent sequence of values.
*/
public interface ArrayValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/**
* The interface {@code BinaryValue} represents MessagePack's Binary type.
* <p/>
*
* MessagePack's Binary type can represent a byte array at most 2<sup>64</sup>-1 bytes.
*
* @see org.msgpack.value.RawValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/**
* The interface {@code BooleanValue} represents MessagePack's Boolean type.
* <p/>
*
* MessagePack's Boolean type can represent {@code true} or {@code false}.
*/
public interface BooleanValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

/**
* The interface {@code ExtensionValue} represents MessagePack's Extension type.
* <p/>
*
* MessagePack's Extension type can represent represents a tuple of type information and a byte array where type information is an
* integer whose meaning is defined by applications.
* <p/>
*
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/**
* The interface {@code FloatValue} represents MessagePack's Float type.
* <p/>
*
* MessagePack's Float type can represent IEEE 754 double precision floating point numbers including NaN and infinity. This is same with Java's {@code double} type.
*
* @see org.msgpack.value.NumberValue
Expand Down
12 changes: 6 additions & 6 deletions msgpack-core/src/main/java/org/msgpack/value/IntegerValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* The interface {@code IntegerValue} represents MessagePack's Integer type.
* <p/>
*
* MessagePack's Integer type can represent from -2<sup>63</sup> to 2<sup>64</sup>-1.
*/
public interface IntegerValue
Expand Down Expand Up @@ -58,31 +58,31 @@ public interface IntegerValue
*
* @throws MessageIntegerOverflowException If the value does not fit in the range of {@code byte} type.
*/
byte getByte();
byte asByte();

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

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

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

/**
* Returns the value as a {@code BigInteger}.
*/
BigInteger getBigInteger();
BigInteger asBigInteger();
}
6 changes: 3 additions & 3 deletions msgpack-core/src/main/java/org/msgpack/value/MapValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* The interface {@code ArrayValue} represents MessagePack's Map type.
* <p/>
*
* MessagePack's Map type can represent sequence of key-value pairs.
*/
public interface MapValue
Expand All @@ -45,9 +45,9 @@ public interface MapValue

/**
* Returns the key-value pairs as an array of {@code Value}.
* <p/>
*
* Odd elements are keys. Next element of an odd element is a value corresponding to the key.
* <p/>
*
* For example, if this value represents <code>{"k1": "v1", "k2": "v2"}</code>, this method returns ["k1", "v1", "k2", "v2"].
*/
Value[] getKeyValueArray();
Expand Down
16 changes: 8 additions & 8 deletions msgpack-core/src/main/java/org/msgpack/value/NumberValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.math.BigInteger;

/**
* The base interface {@code NumberValue} of {@code IntegerValue} and {@code FloatValue}.
* The base interface {@code NumberValue} of {@code IntegerValue} and {@code FloatValue}. To extract primitive type values, call toXXX methods, which may lose some information by rounding or truncation.
*
* @see org.msgpack.value.IntegerValue
* @see org.msgpack.value.FloatValue
Expand All @@ -30,36 +30,36 @@ public interface NumberValue
* Represent this value as a byte value, which may involve rounding or truncation of the original value.
* the value.
*/
byte castAsByte();
byte toByte();

/**
* Represent this value as a short value, which may involve rounding or truncation of the original value.
*/
short castAsShort();
short toShort();

/**
* Represent this value as an int value, which may involve rounding or truncation of the original value.
* value.
*/
int castAsInt();
int toInt();

/**
* Represent this value as a long value, which may involve rounding or truncation of the original value.
*/
long castAsLong();
long toLong();

/**
* Represent this value as a BigInteger, which may involve rounding or truncation of the original value.
*/
BigInteger castAsBigInteger();
BigInteger toBigInteger();

/**
* Represent this value as a 32-bit float value, which may involve rounding or truncation of the original value.
*/
float castAsFloat();
float toFloat();

/**
* Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.
*/
double castAsDouble();
double toDouble();
}
16 changes: 8 additions & 8 deletions msgpack-core/src/main/java/org/msgpack/value/RawValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@ public interface RawValue
{
/**
* Returns the value as {@code byte[]}.
* <p/>
*
* This method copies the byte array.
*/
byte[] getByteArray();
byte[] asByteArray();

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

/**
* Returns the value as {@code String}.
* <p/>
*
* This method throws an exception if the value includes invalid UTF-8 byte sequence.
*
* @throws MessageStringCodingException If this value includes invalid UTF-8 byte sequence.
*/
String getString();
String asString();

/**
* Returns the value as {@code String}.
* <p/>
*
* This method replaces an invalid UTF-8 byte sequence with <code>U+FFFD replacement character</code>.
*/
String stringValue();
String toString();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to keep toString() to override JavaDoc.

}
6 changes: 3 additions & 3 deletions msgpack-core/src/main/java/org/msgpack/value/StringValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

/**
* The interface {@code StringValue} represents MessagePack's String type.
* <p/>
*
* MessagePack's String type can represent a UTF-8 string at most 2<sup>64</sup>-1 bytes.
* <p/>
* Note that the value could include invalid byte sequences. {@code getString()} method throws {@code MessageTypeStringCodingException} if the value includes invalid byte sequence. {@code stringValue()} method replaces an invalid byte sequence with <code>U+FFFD replacement character</code>.
*
* Note that the value could include invalid byte sequences. {@code asString()} method throws {@code MessageTypeStringCodingException} if the value includes invalid byte sequence. {@code toJson()} method replaces an invalid byte sequence with <code>U+FFFD replacement character</code>.
*
* @see org.msgpack.value.RawValue
*/
Expand Down
Loading