mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Add eq override
This commit is contained in:
@@ -1,3 +1,44 @@
|
||||
package dev.kruhlmann.imgfloat.service.media;
|
||||
|
||||
public record OptimizedAsset(byte[] bytes, String mediaType, int width, int height, byte[] previewBytes) {}
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public record OptimizedAsset(
|
||||
byte[] bytes,
|
||||
String mediaType,
|
||||
int width,
|
||||
int height,
|
||||
byte[] previewBytes
|
||||
) {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
OptimizedAsset that = (OptimizedAsset) o;
|
||||
return width == that.width
|
||||
&& height == that.height
|
||||
&& Arrays.equals(bytes, that.bytes)
|
||||
&& Arrays.equals(previewBytes, that.previewBytes)
|
||||
&& Objects.equals(mediaType, that.mediaType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = Objects.hash(mediaType, width, height);
|
||||
result = 31 * result + Arrays.hashCode(bytes);
|
||||
result = 31 * result + Arrays.hashCode(previewBytes);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OptimizedAsset{" +
|
||||
"bytes=" + Arrays.toString(bytes) +
|
||||
", mediaType='" + mediaType + '\'' +
|
||||
", width=" + width +
|
||||
", height=" + height +
|
||||
", previewBytes=" + Arrays.toString(previewBytes) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user