本文整理匯總了Java中com.amazonaws.services.dynamodbv2.model.AttributeValue.getN方法的典型用法代碼示例。如果您正苦於以下問題:Java AttributeValue.getN方法的具體用法?Java AttributeValue.getN怎麽用?Java AttributeValue.getN使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.dynamodbv2.model.AttributeValue
的用法示例。
在下文中一共展示了AttributeValue.getN方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAttributeSizeBytes
import com.amazonaws.services.dynamodbv2.model.AttributeValue; //導入方法依賴的package包/類
private static int getAttributeSizeBytes(AttributeValue att) throws UnsupportedEncodingException {
int byteSize = 0;
if (att.getN() != null) {
byteSize += att.getN().getBytes(CHARACTER_ENCODING).length;
} else if (att.getS() != null) {
byteSize += att.getS().getBytes(CHARACTER_ENCODING).length;
} else if (att.getB() != null) {
byteSize += att.getB().array().length;
} else if (att.getNS() != null) {
for (String number : att.getNS()) {
byteSize += number.getBytes(CHARACTER_ENCODING).length;
}
} else if (att.getSS() != null) {
for (String string : att.getSS()) {
byteSize += string.getBytes(CHARACTER_ENCODING).length;
}
} else if (att.getBS() != null) {
for (ByteBuffer byteBuffer : att.getBS()) {
byteSize += byteBuffer.array().length;
}
}
return byteSize;
}
示例2: getValueAsString
import com.amazonaws.services.dynamodbv2.model.AttributeValue; //導入方法依賴的package包/類
private String getValueAsString(AttributeValue attributeValue) {
if (attributeValue.getS() != null) {
return attributeValue.getS();
} else if (attributeValue.getN() != null) {
return attributeValue.getN();
} else {
throw new ParseException("Attribute value could not be extracted.");
}
}
示例3: compareValue
import com.amazonaws.services.dynamodbv2.model.AttributeValue; //導入方法依賴的package包/類
@Override
public int compareValue(AttributeValue attribute) {
BigDecimal passedKey = new BigDecimal(attribute.getN());
if (number == null) {
number = new BigDecimal(key);
}
return number.compareTo(passedKey);
}