Skip to content

Commit d9be1e6

Browse files
committed
Add hashCode
1 parent c52ffd1 commit d9be1e6

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

msgpack-core/src/main/java/org/msgpack/core/MessagePack.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ public static class PackerConfig
251251
private boolean str8FormatSupport = true;
252252

253253
public PackerConfig()
254-
{ }
254+
{
255+
}
255256

256257
private PackerConfig(PackerConfig copy)
257258
{
@@ -267,6 +268,16 @@ public PackerConfig clone()
267268
return new PackerConfig(this);
268269
}
269270

271+
@Override
272+
public int hashCode()
273+
{
274+
int result = smallStringOptimizationThreshold;
275+
result = 31 * result + bufferFlushThreshold;
276+
result = 31 * result + bufferSize;
277+
result = 31 * result + (str8FormatSupport ? 1 : 0);
278+
return result;
279+
}
280+
270281
@Override
271282
public boolean equals(Object obj)
272283
{
@@ -410,7 +421,8 @@ public static class UnpackerConfig
410421
private int stringDecoderBufferSize = 8192;
411422

412423
public UnpackerConfig()
413-
{ }
424+
{
425+
}
414426

415427
private UnpackerConfig(UnpackerConfig copy)
416428
{
@@ -428,6 +440,19 @@ public UnpackerConfig clone()
428440
return new UnpackerConfig(this);
429441
}
430442

443+
@Override
444+
public int hashCode()
445+
{
446+
int result = (allowReadingStringAsBinary ? 1 : 0);
447+
result = 31 * result + (allowReadingBinaryAsString ? 1 : 0);
448+
result = 31 * result + (actionOnMalformedString != null ? actionOnMalformedString.hashCode() : 0);
449+
result = 31 * result + (actionOnUnmappableString != null ? actionOnUnmappableString.hashCode() : 0);
450+
result = 31 * result + stringSizeLimit;
451+
result = 31 * result + bufferSize;
452+
result = 31 * result + stringDecoderBufferSize;
453+
return result;
454+
}
455+
431456
@Override
432457
public boolean equals(Object obj)
433458
{

0 commit comments

Comments
 (0)