    001/**
    002 *   Copyright (C) 2011-2012 Typesafe Inc. <http://typesafe.com>
    003 */
    004package com.typesafe.config;
    005
    006import java.util.List;
    007
    008/**
    009 * Subtype of {@link ConfigValue} representing a list value, as in JSON's
    010 * {@code [1,2,3]} syntax.
    011 *
    012 * <p>
    013 * {@code ConfigList} implements {@code java.util.List<ConfigValue>} so you can
    014 * use it like a regular Java list. Or call {@link #unwrapped()} to unwrap the
    015 * list elements into plain Java values.
    016 *
    017 * <p>
    018 * Like all {@link ConfigValue} subtypes, {@code ConfigList} is immutable. This
    019 * makes it threadsafe and you never have to create "defensive copies." The
    020 * mutator methods from {@link java.util.List} all throw
    021 * {@link java.lang.UnsupportedOperationException}.
    022 *
    023 * <p>
    024 * The {@link ConfigValue#valueType} method on a list returns
    025 * {@link ConfigValueType#LIST}.
    026 *
    027 * <p>
    028 * <em>Do not implement {@code ConfigList}</em>; it should only be implemented
    029 * by the config library. Arbitrary implementations will not work because the
    030 * library internals assume a specific concrete implementation. Also, this
    031 * interface is likely to grow new methods over time, so third-party
    032 * implementations will break.
    033 *
    034 */
    035public interface ConfigList extends List<ConfigValue>, ConfigValue {
    036
    037    /**
    038     * Recursively unwraps the list, returning a list of plain Java values such
    039     * as Integer or String or whatever is in the list.
    040     */
    041    @Override
    042    List<Object> unwrapped();
    043
    044    @Override
    045    ConfigList withOrigin(ConfigOrigin origin);
    046}