Example usage for com.amazonaws.services.dynamodbv2.model AttributeValue isNULL

List of usage examples for com.amazonaws.services.dynamodbv2.model AttributeValue isNULL

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model AttributeValue isNULL.

Prototype


public Boolean isNULL() 

Source Link

Document

An attribute of type Null.

Usage

From source file:org.apache.metamodel.dynamodb.DynamoDbUtils.java

License:Apache License

public static Object toValue(AttributeValue a) {
    if (a == null || Boolean.TRUE == a.isNULL()) {
        return null;
    }//from w w  w . ja v a 2 s. com
    // dynamo is a bit funky this way ... it has a getter for each possible
    // data type.
    return firstNonNull(a.getB(), a.getBOOL(), a.getBS(), a.getL(), a.getM(), a.getN(), a.getNS(), a.getS(),
            a.getSS());
}

From source file:org.xmlsh.aws.util.AWSDDBCommand.java

License:BSD License

protected void writeAttributeValue(AttributeValue avalue) throws XMLStreamException, IOException {
    if (avalue.getS() != null) {
        attribute(AttrType.S);//  w w w .  ja va2  s .  c  o  m
        characters(avalue.getS());
    } else if (avalue.getN() != null) {
        attribute(AttrType.N);
        characters(avalue.getN());
    } else

    if (avalue.getB() != null) {
        attribute(AttrType.B);
        binary(avalue.getB().array());
    } else if (avalue.getSS() != null) {
        attribute(AttrType.SS);

        for (String s : avalue.getSS()) {
            startElement("value");
            characters(s);
            endElement();
        }

    } else if (avalue.getNS() != null) {
        attribute(AttrType.NS);

        for (String s : avalue.getNS()) {
            startElement("value");
            characters(s);
            endElement();
        }
    } else if (avalue.getBS() != null) {
        attribute(AttrType.BS);

        for (ByteBuffer s : avalue.getBS()) {
            startElement("value");
            binary(s.array());
            endElement();
        }
    } else if (avalue.getL() != null) {
        attribute(AttrType.L);
        for (AttributeValue av : avalue.getL()) {
            startElement("value");
            writeAttributeValue(av);
            endElement();
        }
    } else if (avalue.getM() != null) {
        attribute(AttrType.M);
        for (Entry<String, AttributeValue> e : avalue.getM().entrySet()) {
            writeAttribute(e.getKey(), e.getValue());
        }
    } else if (avalue.isBOOL() != null) {
        attribute(AttrType.BOOL);
        characters(avalue.getBOOL().booleanValue() ? "true" : "false");
    } else if (avalue.isNULL() != null) {
        attribute(AttrType.NULL);
        characters(avalue.getNULL().booleanValue() ? "true" : "false");
    }

}