Skip to content

Commit b45d73c

Browse files
committed
fixed integral nodes handling of {byte,short,int,long}Value()
1 parent c72c822 commit b45d73c

File tree

5 files changed

+20
-35
lines changed

5 files changed

+20
-35
lines changed

src/main/java/com/github/autermann/yaml/nodes/YamlByteNode.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,6 @@ public byte byteValue() {
6060
return this.value;
6161
}
6262

63-
@Override
64-
public long longValue() {
65-
return (long) this.value;
66-
}
67-
68-
@Override
69-
public int intValue() {
70-
return (int) this.value;
71-
}
72-
73-
@Override
74-
public short shortValue() {
75-
return (short) this.value;
76-
}
77-
7863
@Override
7964
public Byte value() {
8065
return this.value;

src/main/java/com/github/autermann/yaml/nodes/YamlIntegerNode.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ public int intValue() {
6262
return this.value;
6363
}
6464

65-
@Override
66-
public byte byteValue() {
67-
return (byte) this.value;
68-
}
69-
70-
@Override
71-
public short shortValue() {
72-
return (short) this.value;
73-
}
74-
7565
@Override
7666
public Integer value() {
7767
return value;

src/main/java/com/github/autermann/yaml/nodes/YamlIntegralNode.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,41 @@ public boolean isLong() {
5050
return fitsIntoLong();
5151
}
5252

53+
@Override
54+
public long longValue() {
55+
return value().longValue();
56+
}
57+
5358
@Override
5459
public boolean isInt() {
5560
return fitsIntoInt();
5661
}
5762

63+
@Override
64+
public int intValue() {
65+
return value().intValue();
66+
}
67+
5868
@Override
5969
public boolean isShort() {
6070
return fitsIntoShort();
6171
}
6272

73+
@Override
74+
public short shortValue() {
75+
return value().shortValue();
76+
}
77+
6378
@Override
6479
public boolean isByte() {
6580
return fitsIntoByte();
6681
}
6782

83+
@Override
84+
public byte byteValue() {
85+
return value().byteValue();
86+
}
87+
6888
@Override
6989
public BigInteger bigIntegerValue() {
7090
return BigInteger.valueOf(numberValue().longValue());

src/main/java/com/github/autermann/yaml/nodes/YamlLongNode.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ public boolean fitsIntoShort() {
5858
return Numbers.fitsIntoShort(value);
5959
}
6060

61-
@Override
62-
public long longValue() {
63-
return this.value;
64-
}
65-
6661
@Override
6762
public Long value() {
6863
return this.value;

src/main/java/com/github/autermann/yaml/nodes/YamlShortNode.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ public short shortValue() {
6969
return this.value;
7070
}
7171

72-
@Override
73-
public byte byteValue() {
74-
return (byte) this.value;
75-
}
76-
7772
@Override
7873
public Short value() {
7974
return this.value;

0 commit comments

Comments
 (0)