@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); hashCode = prime * hashCode + ((getStringListValues() == null) ? 0 : getStringListValues().hashCode()); hashCode = prime * hashCode + ((getBinaryListValues() == null) ? 0 : getBinaryListValues().hashCode()); hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().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 (getStringValue() != null) sb.append("StringValue: ").append(getStringValue()).append(","); if (getBinaryValue() != null) sb.append("BinaryValue: ").append(getBinaryValue()).append(","); if (getStringListValues() != null) sb.append("StringListValues: ").append(getStringListValues()).append(","); if (getBinaryListValues() != null) sb.append("BinaryListValues: ").append(getBinaryListValues()).append(","); if (getDataType() != null) sb.append("DataType: ").append(getDataType()); sb.append("}"); return sb.toString(); }
if (other.getBinaryListValues() != null && other.getBinaryListValues().equals(this.getBinaryListValues()) == false) return false; if (other.getDataType() == null ^ this.getDataType() == null) return false; if (other.getDataType() != null && other.getDataType().equals(this.getDataType()) == false) return false; return true;
updateLengthAndBytes(md5Digest, attrValue.getDataType());
if (entry.getValue().getDataType() != null) { request.addParameter("MessageAttribute." + messageAttributesListIndex + ".Value.DataType", StringUtils.fromString(entry.getValue().getDataType()));
if (entry.getValue().getDataType() != null) { request.addParameter("SendMessageBatchRequestEntry." + entriesListIndex + ".MessageAttribute." + messageAttributesListIndex + ".Value.DataType", StringUtils.fromString(entry.getValue().getDataType()));
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); hashCode = prime * hashCode + ((getStringListValues() == null) ? 0 : getStringListValues().hashCode()); hashCode = prime * hashCode + ((getBinaryListValues() == null) ? 0 : getBinaryListValues().hashCode()); hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().hashCode()); return hashCode; }
/** * 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 (getStringValue() != null) sb.append("StringValue: " + getStringValue() + ","); if (getBinaryValue() != null) sb.append("BinaryValue: " + getBinaryValue() + ","); if (getStringListValues() != null) sb.append("StringListValues: " + getStringListValues() + ","); if (getBinaryListValues() != null) sb.append("BinaryListValues: " + getBinaryListValues() + ","); if (getDataType() != null) sb.append("DataType: " + getDataType()); sb.append("}"); return sb.toString(); }
&& other.getBinaryListValues().equals(this.getBinaryListValues()) == false) return false; if (other.getDataType() == null ^ this.getDataType() == null) return false; if (other.getDataType() != null && other.getDataType().equals(this.getDataType()) == false) return false; return true;
updateLengthAndBytes(md5Digest, attrValue.getDataType());
if (_messageAttributeValue.getDataType() != null) { prefix = _prefix + "DataType"; String dataType = _messageAttributeValue.getDataType(); request.addParameter(prefix, StringUtils.fromString(dataType));
private void addMessageAttributes(com.amazonaws.services.sqs.model.Message sqsMessage) throws JMSException { for (Entry<String, MessageAttributeValue> entry : sqsMessage.getMessageAttributes().entrySet()) { properties.put(entry.getKey(), new JMSMessagePropertyValue( entry.getValue().getStringValue(), entry.getValue().getDataType())); } }
private static Object getNumberValue(MessageAttributeValue value) { String numberType = value.getDataType().substring(MessageAttributeDataTypes.NUMBER.length() + 1); try { Class<? extends Number> numberTypeClass = Class.forName(numberType).asSubclass(Number.class); return NumberUtils.parseNumber(value.getStringValue(), numberTypeClass); } catch (ClassNotFoundException e) { throw new MessagingException(String.format("Message attribute with value '%s' and data type '%s' could not be converted " + "into a Number because target class was not found.", value.getStringValue(), value.getDataType()), e); } }
private static Object getNumberValue(MessageAttributeValue value) { String numberType = value.getDataType().substring(MessageAttributeDataTypes.NUMBER.length() + 1); try { Class<? extends Number> numberTypeClass = Class.forName(numberType).asSubclass(Number.class); return NumberUtils.parseNumber(value.getStringValue(), numberTypeClass); } catch (ClassNotFoundException e) { throw new MessagingException(String.format("Message attribute with value '%s' and data type '%s' could not be converted " + "into a Number because target class was not found.", value.getStringValue(), value.getDataType()), e); } }
private void addMessageAttributes(com.amazonaws.services.sqs.model.Message sqsMessage) throws JMSException { for (Entry<String, MessageAttributeValue> entry : sqsMessage.getMessageAttributes().entrySet()) { properties.put(entry.getKey(), new JMSMessagePropertyValue( entry.getValue().getStringValue(), entry.getValue().getDataType())); } }
private static Map<String, Object> getMessageAttributesAsMessageHeaders(com.amazonaws.services.sqs.model.Message message) { Map<String, Object> messageHeaders = new HashMap<>(); for (Map.Entry<String, MessageAttributeValue> messageAttribute : message.getMessageAttributes().entrySet()) { if (MessageHeaders.CONTENT_TYPE.equals(messageAttribute.getKey())) { messageHeaders.put(MessageHeaders.CONTENT_TYPE, MimeType.valueOf(messageAttribute.getValue().getStringValue())); } else if (MessageHeaders.ID.equals(messageAttribute.getKey())) { messageHeaders.put(MessageHeaders.ID, UUID.fromString(messageAttribute.getValue().getStringValue())); } else if (MessageAttributeDataTypes.STRING.equals(messageAttribute.getValue().getDataType())) { messageHeaders.put(messageAttribute.getKey(), messageAttribute.getValue().getStringValue()); } else if (messageAttribute.getValue().getDataType().startsWith(MessageAttributeDataTypes.NUMBER)) { Object numberValue = getNumberValue(messageAttribute.getValue()); if (numberValue != null) { messageHeaders.put(messageAttribute.getKey(), numberValue); } } else if (MessageAttributeDataTypes.BINARY.equals(messageAttribute.getValue().getDataType())) { messageHeaders.put(messageAttribute.getKey(), messageAttribute.getValue().getBinaryValue()); } } return messageHeaders; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); hashCode = prime * hashCode + ((getStringListValues() == null) ? 0 : getStringListValues().hashCode()); hashCode = prime * hashCode + ((getBinaryListValues() == null) ? 0 : getBinaryListValues().hashCode()); hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); hashCode = prime * hashCode + ((getStringListValues() == null) ? 0 : getStringListValues().hashCode()); hashCode = prime * hashCode + ((getBinaryListValues() == null) ? 0 : getBinaryListValues().hashCode()); hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().hashCode()); return hashCode; }
private int getMsgAttributesSize(Map<String, MessageAttributeValue> msgAttributes) { int totalMsgAttributesSize = 0; for (Entry<String, MessageAttributeValue> entry : msgAttributes.entrySet()) { totalMsgAttributesSize += getStringSizeInBytes(entry.getKey()); MessageAttributeValue entryVal = entry.getValue(); if (entryVal.getDataType() != null) { totalMsgAttributesSize += getStringSizeInBytes(entryVal.getDataType()); } String stringVal = entryVal.getStringValue(); if (stringVal != null) { totalMsgAttributesSize += getStringSizeInBytes(entryVal.getStringValue()); } ByteBuffer binaryVal = entryVal.getBinaryValue(); if (binaryVal != null) { totalMsgAttributesSize += binaryVal.array().length; } } return totalMsgAttributesSize; }
public CQSMessage(Message message) { this.messageId = message.getMessageId(); this.receiptHandle = message.getReceiptHandle(); this.body = message.getBody(); this.mD5OfBody = message.getMD5OfBody(); this.messageAttributes = new HashMap<String, CQSMessageAttribute>(); for (String messageAttributeName : message.getMessageAttributes().keySet()) { MessageAttributeValue messageAttributeValue = message.getMessageAttributes().get(messageAttributeName); CQSMessageAttribute ma = new CQSMessageAttribute(messageAttributeValue.getStringValue(), messageAttributeValue.getDataType()); this.messageAttributes.put(messageAttributeName, ma); } this.md5OfMessageAttributes = message.getMD5OfMessageAttributes(); }