com.infomaximum.cluster.graphql.struct.subscribe.SubscribeKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cluster-graphql Show documentation
Show all versions of cluster-graphql Show documentation
Library for creating a light cluster
package com.infomaximum.cluster.graphql.struct.subscribe;
import com.infomaximum.cluster.core.remote.struct.RemoteObject;
import com.infomaximum.cluster.struct.Component;
import java.nio.ByteBuffer;
import java.util.Arrays;
public class SubscribeKey implements RemoteObject {
private final byte[] key;
public SubscribeKey(Component component, byte[] subscribeKey) {
this(component.getUniqueId(), subscribeKey);
}
public SubscribeKey(int componentUniqueId, byte[] subscribeKey) {
key = ByteBuffer.allocate(Integer.BYTES + subscribeKey.length)
.putInt(componentUniqueId)
.put(subscribeKey)
.array();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof SubscribeKey)) {
return false;
}
return Arrays.equals(key, ((SubscribeKey) other).key);
}
@Override
public int hashCode() {
return Arrays.hashCode(key);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy