Skip to content

Commit c274695

Browse files
committed
Merge pull request msgpack#265 from xerial/rename-dataaccess
msgpack#259: Rename data access methods
2 parents b80b06e + 641dacd commit c274695

28 files changed

+372
-186
lines changed

msgpack-core/src/main/java/org/msgpack/value/ArrayValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* The interface {@code ArrayValue} represents MessagePack's Array type.
23-
* <p/>
23+
*
2424
* MessagePack's Array type can represent sequence of values.
2525
*/
2626
public interface ArrayValue

msgpack-core/src/main/java/org/msgpack/value/BinaryValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* The interface {@code BinaryValue} represents MessagePack's Binary type.
20-
* <p/>
20+
*
2121
* MessagePack's Binary type can represent a byte array at most 2<sup>64</sup>-1 bytes.
2222
*
2323
* @see org.msgpack.value.RawValue

msgpack-core/src/main/java/org/msgpack/value/BooleanValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* The interface {@code BooleanValue} represents MessagePack's Boolean type.
20-
* <p/>
20+
*
2121
* MessagePack's Boolean type can represent {@code true} or {@code false}.
2222
*/
2323
public interface BooleanValue

msgpack-core/src/main/java/org/msgpack/value/ExtensionValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
/**
1919
* The interface {@code ExtensionValue} represents MessagePack's Extension type.
20-
* <p/>
20+
*
2121
* MessagePack's Extension type can represent represents a tuple of type information and a byte array where type information is an
2222
* integer whose meaning is defined by applications.
23-
* <p/>
23+
*
2424
* 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.
2525
*/
2626
public interface ExtensionValue

msgpack-core/src/main/java/org/msgpack/value/FloatValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* The interface {@code FloatValue} represents MessagePack's Float type.
20-
* <p/>
20+
*
2121
* 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.
2222
*
2323
* @see org.msgpack.value.NumberValue

msgpack-core/src/main/java/org/msgpack/value/IntegerValue.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* The interface {@code IntegerValue} represents MessagePack's Integer type.
24-
* <p/>
24+
*
2525
* MessagePack's Integer type can represent from -2<sup>63</sup> to 2<sup>64</sup>-1.
2626
*/
2727
public interface IntegerValue
@@ -58,31 +58,31 @@ public interface IntegerValue
5858
*
5959
* @throws MessageIntegerOverflowException If the value does not fit in the range of {@code byte} type.
6060
*/
61-
byte getByte();
61+
byte asByte();
6262

6363
/**
6464
* Returns the value as a {@code short}, otherwise throws an exception.
6565
*
6666
* @throws MessageIntegerOverflowException If the value does not fit in the range of {@code short} type.
6767
*/
68-
short getShort();
68+
short asShort();
6969

7070
/**
7171
* Returns the value as an {@code int}, otherwise throws an exception.
7272
*
7373
* @throws MessageIntegerOverflowException If the value does not fit in the range of {@code int} type.
7474
*/
75-
int getInt();
75+
int asInt();
7676

7777
/**
7878
* Returns the value as a {@code long}, otherwise throws an exception.
7979
*
8080
* @throws MessageIntegerOverflowException If the value does not fit in the range of {@code long} type.
8181
*/
82-
long getLong();
82+
long asLong();
8383

8484
/**
8585
* Returns the value as a {@code BigInteger}.
8686
*/
87-
BigInteger getBigInteger();
87+
BigInteger asBigInteger();
8888
}

msgpack-core/src/main/java/org/msgpack/value/MapValue.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* The interface {@code ArrayValue} represents MessagePack's Map type.
24-
* <p/>
24+
*
2525
* MessagePack's Map type can represent sequence of key-value pairs.
2626
*/
2727
public interface MapValue
@@ -45,9 +45,9 @@ public interface MapValue
4545

4646
/**
4747
* Returns the key-value pairs as an array of {@code Value}.
48-
* <p/>
48+
*
4949
* Odd elements are keys. Next element of an odd element is a value corresponding to the key.
50-
* <p/>
50+
*
5151
* For example, if this value represents <code>{"k1": "v1", "k2": "v2"}</code>, this method returns ["k1", "v1", "k2", "v2"].
5252
*/
5353
Value[] getKeyValueArray();

msgpack-core/src/main/java/org/msgpack/value/NumberValue.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.math.BigInteger;
1919

2020
/**
21-
* The base interface {@code NumberValue} of {@code IntegerValue} and {@code FloatValue}.
21+
* 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.
2222
*
2323
* @see org.msgpack.value.IntegerValue
2424
* @see org.msgpack.value.FloatValue
@@ -30,36 +30,36 @@ public interface NumberValue
3030
* Represent this value as a byte value, which may involve rounding or truncation of the original value.
3131
* the value.
3232
*/
33-
byte castAsByte();
33+
byte toByte();
3434

3535
/**
3636
* Represent this value as a short value, which may involve rounding or truncation of the original value.
3737
*/
38-
short castAsShort();
38+
short toShort();
3939

4040
/**
4141
* Represent this value as an int value, which may involve rounding or truncation of the original value.
4242
* value.
4343
*/
44-
int castAsInt();
44+
int toInt();
4545

4646
/**
4747
* Represent this value as a long value, which may involve rounding or truncation of the original value.
4848
*/
49-
long castAsLong();
49+
long toLong();
5050

5151
/**
5252
* Represent this value as a BigInteger, which may involve rounding or truncation of the original value.
5353
*/
54-
BigInteger castAsBigInteger();
54+
BigInteger toBigInteger();
5555

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

6161
/**
6262
* Represent this value as a 64-bit double value, which may involve rounding or truncation of the original value.
6363
*/
64-
double castAsDouble();
64+
double toDouble();
6565
}

msgpack-core/src/main/java/org/msgpack/value/RawValue.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ public interface RawValue
3030
{
3131
/**
3232
* Returns the value as {@code byte[]}.
33-
* <p/>
33+
*
3434
* This method copies the byte array.
3535
*/
36-
byte[] getByteArray();
36+
byte[] asByteArray();
3737

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

4646
/**
4747
* Returns the value as {@code String}.
48-
* <p/>
48+
*
4949
* This method throws an exception if the value includes invalid UTF-8 byte sequence.
5050
*
5151
* @throws MessageStringCodingException If this value includes invalid UTF-8 byte sequence.
5252
*/
53-
String getString();
53+
String asString();
5454

5555
/**
5656
* Returns the value as {@code String}.
57-
* <p/>
57+
*
5858
* This method replaces an invalid UTF-8 byte sequence with <code>U+FFFD replacement character</code>.
5959
*/
60-
String stringValue();
60+
String toString();
6161
}

msgpack-core/src/main/java/org/msgpack/value/StringValue.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
/**
1919
* The interface {@code StringValue} represents MessagePack's String type.
20-
* <p/>
20+
*
2121
* MessagePack's String type can represent a UTF-8 string at most 2<sup>64</sup>-1 bytes.
22-
* <p/>
23-
* 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>.
22+
*
23+
* 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>.
2424
*
2525
* @see org.msgpack.value.RawValue
2626
*/

0 commit comments

Comments
 (0)