Property.java

package net.morimekta.terminal.args;

import net.morimekta.terminal.args.impl.PropertyImpl;

public interface Property extends Option {
    /**
     * @return The meta key name.
     */
    String getMetaKey();

    /**
     * Basic interface for putting values onto a map, properties or config.
     */
    @FunctionalInterface
    interface Putter {
        /**
         * Put the property into place.
         *
         * @param key   The property key.
         * @param value The property value.
         */
        void put(String key, String value);
    }

    interface Builder extends Arg.Builder<Property> {
        Builder metaKey(String metaKey);

        Builder metaVar(String metaVar);

        Builder hidden();
    }

    static Builder propertyLong(String name, String usage, Putter putter) {
        return new PropertyImpl.BuilderImpl(name, null, usage, putter);
    }

    static Builder propertyShort(char shortName, String usage, Putter putter) {
        return new PropertyImpl.BuilderImpl(null, shortName, usage, putter);
    }

    static Builder property(String name, char shortChar, String usage, Putter putter) {
        return new PropertyImpl.BuilderImpl(name, shortChar, usage, putter);
    }
}