/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.lang;

import java.util.Set;

/**
 * An object implementing this interface has zero or more fields which may only
 * be set to pre-defined (restricted) values. An example of this might be a
 * country property which may only be set to a valid country.
 * <p>
 * Objects interfacing this interface should still allow invalid selections to
 * be chosen and stored in the object; this is simply a book-keeping interface.
 * To require the value to be correct during validation, consider the
 * <code>RestrictedValue</code> annotation.
 *
 * @param <T>
 * @author Alex Leigh
 */
public interface RestrictedValues<T> {
    /**
     * Returns true if the given property name is restricted.
     *
     * @param property
     * @return
     */
    boolean restricted(String property);

    /**
     * Returns a set of restricted values which are considered valid choices for
     * the given property.
     *
     * @param property
     * @return
     */
    Set<T> restrictedValues(String property);
}
