    001/**
    002 *   Copyright (C) 2011-2012 Typesafe Inc. <http://typesafe.com>
    003 */
    004package com.typesafe.config;
    005
    006
    007/**
    008 * An opaque handle to something that can be parsed, obtained from
    009 * {@link ConfigIncludeContext}.
    010 *
    011 * <p>
    012 * <em>Do not implement this interface</em>; it should only be implemented by
    013 * the config library. Arbitrary implementations will not work because the
    014 * library internals assume a specific concrete implementation. Also, this
    015 * interface is likely to grow new methods over time, so third-party
    016 * implementations will break.
    017 */
    018public interface ConfigParseable {
    019    /**
    020     * Parse whatever it is. The options should come from
    021     * {@link ConfigParseable#options options()} but you could tweak them if you
    022     * like.
    023     *
    024     * @param options
    025     *            parse options, should be based on the ones from
    026     *            {@link ConfigParseable#options options()}
    027     * @return the parsed object
    028     */
    029    ConfigObject parse(ConfigParseOptions options);
    030
    031    /**
    032     * Returns a {@link ConfigOrigin} describing the origin of the parseable
    033     * item.
    034     * @return the origin of the parseable item
    035     */
    036    ConfigOrigin origin();
    037
    038    /**
    039     * Get the initial options, which can be modified then passed to parse().
    040     * These options will have the right description, includer, and other
    041     * parameters already set up.
    042     * @return the initial options
    043     */
    044    ConfigParseOptions options();
    045}