Skip to content

Commit fb0bd66

Browse files
Continue code tidy-up
1 parent 20f83c6 commit fb0bd66

File tree

3 files changed

+12
-36
lines changed

3 files changed

+12
-36
lines changed

src/main/java/engineer/nightowl/sonos/api/domain/SonosMetadataStatus.java

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package engineer.nightowl.sonos.api.domain;
22

3+
import java.util.Objects;
4+
35
/**
4-
* <p>SonosMetadataStatus class.</p>
6+
* <p>
7+
* SonosMetadataStatus class.
8+
* </p>
59
*/
6-
public class SonosMetadataStatus
7-
{
10+
public class SonosMetadataStatus {
811
private SonosMusicContainer container;
912
private SonosItem currentItem;
1013
private SonosItem nextItem;
@@ -55,45 +58,18 @@ public void setStreamInfo(String streamInfo) {
5558

5659
@Override
5760
public int hashCode() {
58-
final int prime = 31;
59-
int result = 1;
60-
result = prime * result + ((container == null) ? 0 : container.hashCode());
61-
result = prime * result + ((currentItem == null) ? 0 : currentItem.hashCode());
62-
result = prime * result + ((nextItem == null) ? 0 : nextItem.hashCode());
63-
result = prime * result + ((streamInfo == null) ? 0 : streamInfo.hashCode());
64-
return result;
61+
return Objects.hash(container, currentItem, nextItem, streamInfo);
6562
}
6663

6764
@Override
6865
public boolean equals(Object obj) {
6966
if (this == obj)
7067
return true;
71-
if (obj == null)
72-
return false;
73-
if (getClass() != obj.getClass())
68+
if (!(obj instanceof SonosMetadataStatus))
7469
return false;
7570
SonosMetadataStatus other = (SonosMetadataStatus) obj;
76-
if (container == null) {
77-
if (other.container != null)
78-
return false;
79-
} else if (!container.equals(other.container))
80-
return false;
81-
if (currentItem == null) {
82-
if (other.currentItem != null)
83-
return false;
84-
} else if (!currentItem.equals(other.currentItem))
85-
return false;
86-
if (nextItem == null) {
87-
if (other.nextItem != null)
88-
return false;
89-
} else if (!nextItem.equals(other.nextItem))
90-
return false;
91-
if (streamInfo == null) {
92-
if (other.streamInfo != null)
93-
return false;
94-
} else if (!streamInfo.equals(other.streamInfo))
95-
return false;
96-
return true;
71+
return Objects.equals(container, other.container) && Objects.equals(currentItem, other.currentItem)
72+
&& Objects.equals(nextItem, other.nextItem) && Objects.equals(streamInfo, other.streamInfo);
9773
}
9874

9975
@Override

src/main/java/engineer/nightowl/sonos/api/resource/AuthorizeResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
public class AuthorizeResource extends BaseResource
2828
{
2929

30-
private final String HTTPS = "https";
30+
private static final String HTTPS = "https";
3131

3232
/**
3333
* <p>Constructor for AuthorizeResource.</p>

src/main/java/engineer/nightowl/sonos/api/resource/PlayerVolumeResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
public class PlayerVolumeResource extends SubscribableResource
1919
{
20-
private final String MUTED = "muted";
20+
private static final String MUTED = "muted";
2121
/**
2222
* <p>Constructor for PlayerVolumeResource.</p>
2323
*

0 commit comments

Comments
 (0)