@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode()); hashCode = prime * hashCode + ((getExplicitHashKey() == null) ? 0 : getExplicitHashKey().hashCode()); hashCode = prime * hashCode + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode()); return hashCode; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getData() != null) sb.append("Data: ").append(getData()).append(","); if (getExplicitHashKey() != null) sb.append("ExplicitHashKey: ").append(getExplicitHashKey()).append(","); if (getPartitionKey() != null) sb.append("PartitionKey: ").append(getPartitionKey()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutRecordsRequestEntry == false) return false; PutRecordsRequestEntry other = (PutRecordsRequestEntry) obj; if (other.getData() == null ^ this.getData() == null) return false; if (other.getData() != null && other.getData().equals(this.getData()) == false) return false; if (other.getExplicitHashKey() == null ^ this.getExplicitHashKey() == null) return false; if (other.getExplicitHashKey() != null && other.getExplicitHashKey().equals(this.getExplicitHashKey()) == false) return false; if (other.getPartitionKey() == null ^ this.getPartitionKey() == null) return false; if (other.getPartitionKey() != null && other.getPartitionKey().equals(this.getPartitionKey()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(PutRecordsRequestEntry putRecordsRequestEntry, ProtocolMarshaller protocolMarshaller) { if (putRecordsRequestEntry == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putRecordsRequestEntry.getData(), DATA_BINDING); protocolMarshaller.marshall(putRecordsRequestEntry.getExplicitHashKey(), EXPLICITHASHKEY_BINDING); protocolMarshaller.marshall(putRecordsRequestEntry.getPartitionKey(), PARTITIONKEY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode()); hashCode = prime * hashCode + ((getExplicitHashKey() == null) ? 0 : getExplicitHashKey().hashCode()); hashCode = prime * hashCode + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode()); return hashCode; }
public Optional<PutRecordsRequest> put(PutRecordsRequestEntry entry) { int newRequestSize = requestSize + entry.getData().remaining() + entry.getPartitionKey().length(); if (entries.size() < maxCount && newRequestSize <= maxSize) { requestSize = newRequestSize; entries.add(entry); return Optional.empty(); } else { Optional<PutRecordsRequest> ret = flush(); put(entry); return ret; } }
protected void addEntry(PutRecordsRequestEntry entry) { int newDataSize = dataSize + entry.getData().remaining() + entry.getPartitionKey().length(); if (newDataSize <= 5 * 1024 * 1024 && entries.size() < 500) { dataSize = newDataSize; entries.add(entry); } else { flush(); dataSize = 0; addEntry(entry); } } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getData() != null) sb.append("Data: " + getData() + ","); if (getExplicitHashKey() != null) sb.append("ExplicitHashKey: " + getExplicitHashKey() + ","); if (getPartitionKey() != null) sb.append("PartitionKey: " + getPartitionKey()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutRecordsRequestEntry == false) return false; PutRecordsRequestEntry other = (PutRecordsRequestEntry) obj; if (other.getData() == null ^ this.getData() == null) return false; if (other.getData() != null && other.getData().equals(this.getData()) == false) return false; if (other.getExplicitHashKey() == null ^ this.getExplicitHashKey() == null) return false; if (other.getExplicitHashKey() != null && other.getExplicitHashKey().equals(this.getExplicitHashKey()) == false) return false; if (other.getPartitionKey() == null ^ this.getPartitionKey() == null) return false; if (other.getPartitionKey() != null && other.getPartitionKey().equals(this.getPartitionKey()) == false) return false; return true; } }
public void marshall(PutRecordsRequestEntry putRecordsRequestEntry, AwsJsonWriter jsonWriter) throws Exception { jsonWriter.beginObject(); if (putRecordsRequestEntry.getData() != null) { java.nio.ByteBuffer data = putRecordsRequestEntry.getData(); jsonWriter.name("Data"); jsonWriter.value(data); } if (putRecordsRequestEntry.getExplicitHashKey() != null) { String explicitHashKey = putRecordsRequestEntry.getExplicitHashKey(); jsonWriter.name("ExplicitHashKey"); jsonWriter.value(explicitHashKey); } if (putRecordsRequestEntry.getPartitionKey() != null) { String partitionKey = putRecordsRequestEntry.getPartitionKey(); jsonWriter.name("PartitionKey"); jsonWriter.value(partitionKey); } jsonWriter.endObject(); }
for(PutRecordsRequestEntry record:records) String partitionKey = record.getPartitionKey(); assertFalse("There are duplicated partition keys", partitionKeys.contains(partitionKey)); partitionKeys.add(partitionKey);
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode()); hashCode = prime * hashCode + ((getExplicitHashKey() == null) ? 0 : getExplicitHashKey().hashCode()); hashCode = prime * hashCode + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode()); return hashCode; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getData() != null) sb.append("Data: ").append(getData()).append(","); if (getExplicitHashKey() != null) sb.append("ExplicitHashKey: ").append(getExplicitHashKey()).append(","); if (getPartitionKey() != null) sb.append("PartitionKey: ").append(getPartitionKey()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutRecordsRequestEntry == false) return false; PutRecordsRequestEntry other = (PutRecordsRequestEntry) obj; if (other.getData() == null ^ this.getData() == null) return false; if (other.getData() != null && other.getData().equals(this.getData()) == false) return false; if (other.getExplicitHashKey() == null ^ this.getExplicitHashKey() == null) return false; if (other.getExplicitHashKey() != null && other.getExplicitHashKey().equals(this.getExplicitHashKey()) == false) return false; if (other.getPartitionKey() == null ^ this.getPartitionKey() == null) return false; if (other.getPartitionKey() != null && other.getPartitionKey().equals(this.getPartitionKey()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(PutRecordsRequestEntry putRecordsRequestEntry, ProtocolMarshaller protocolMarshaller) { if (putRecordsRequestEntry == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putRecordsRequestEntry.getData(), DATA_BINDING); protocolMarshaller.marshall(putRecordsRequestEntry.getExplicitHashKey(), EXPLICITHASHKEY_BINDING); protocolMarshaller.marshall(putRecordsRequestEntry.getPartitionKey(), PARTITIONKEY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }