Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   *
   *  http://aws.amazon.com/apache2.0
   *
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.dynamodbv2.document.utils;
 
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
Utility value list.
 
 public class ValueList extends FluentArrayList<Object> {
     private static final long serialVersionUID = 1L;
 
     public ValueList(int initialCapacity) {
         super(initialCapacity);
     }
 
     public ValueList(Object ... elements) {
         super(elements);
     }
 
     public ValueList() {
         super();
     }
 
     public ValueList(Collection<?> c) {
         super(c);
     }
 
     public ValueList appendAll(Object ... elements) {
         super.appendAll(elements);
         return this;
     }

    
Appends the given value to this list.
 
     public ValueList appendString(String val) {
         super.append(val);
         return this;
     }

    
Appends the given value to this list.
 
     public ValueList appendNumber(BigDecimal val) {
         super.append(val);
         return this;
     }

    
Appends the given value to this list.
 
     public ValueList appendNumber(Number val) {
         super.append(InternalUtils.toBigDecimal(val));
         return this;
     }

    
Appends the given value to this list.
 
     public ValueList appendInt(int val) {
         return appendNumber(Integer.valueOf(val));
     }

    
Appends the given value to this list.
 
     public ValueList appendLong(long val) {
         return appendNumber(Long.valueOf(val));
     }

    
Appends the given value to this list.
 
     public ValueList appendBinary(byte[] val) {
         super.append(val);
         return this;
     }

    
Appends the given value to this list.
    public ValueList appendStringSet(Set<Stringval) {
        super.append(val);
        return this;
    }

    
Appends the given values to this list as a string set.
    public ValueList appendStringSet(String ...val) {
        super.append(new LinkedHashSet<String>(Arrays.asList(val)));
        return this;
    }

    
Appends the given value to this list.
    public ValueList appendNumberSet(Set<BigDecimalval) {
        super.append(val);
        return this;
    }

    
Appends the given value to this list as a set of BigDecimals.
    public ValueList appendNumberSet(BigDecimal ... val) {
        super.append(new LinkedHashSet<BigDecimal>(Arrays.asList(val)));
        return this;
    }

    
Appends the given values to this list as a number set.
    public ValueList appendNumberSet(Number ... val) {
        super.append(InternalUtils.toBigDecimalSet(val));
        return this;
    }

    
Appends the given value to this list.
    public ValueList appendBinarySet(Set<byte[]> val) {
        super.append(val);
        return this;
    }

    
Appends the given values to this list as a set of byte arrays.
    public ValueList appendBinarySet(byte[] ... val) {
        super.append(new LinkedHashSet<byte[]>(Arrays.asList(val)));
        return this;
    }

    
Appends the given value to this list.
    public ValueList appendList(List<?> val) {
        super.append(new ArrayList<Object>(val));
        return this;
    }

    
Appends the given values to this list as a list.
    public ValueList appendList(Object ... vals) {
        super.append(new ArrayList<Object>(Arrays.asList(vals)));
        return this;
    }

    
Appends the given value to this list.
    public ValueList appendMap(Map<String, ?> val) {
        super.append(val);
        return this;
    }

    
Appends the given value to this list.
    public ValueList appendBoolean(boolean val) {
        super.append(Boolean.valueOf(val));
        return this;
    }

    
Appends a null value to this list.
    public ValueList appendNull() {
        super.append(null);
        return this;
    }

    
Appends the given value to this list. A value can be a
  • Number
  • String
  • binary (ie byte array or byte buffer)
  • boolean
  • null
  • list (of any of the types on this list)
  • map (append string key to value of any of the types on this list)
  • set (of any of the types on this list)
    public ValueList append(Object val) {
        if (val == this)
            throw new IllegalArgumentException("Self reference is not allowed");
        // TODO: fail fast if val is not a supported type
        super.append(val);
        return this;
    }
New to GrepCode? Check out our FAQ X