All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.ocl.options.Customizable Maven / Gradle / Ivy

/**
 * 
 *
 * Copyright (c) 2007 IBM Corporation and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   IBM - Initial API and implementation
 *
 * 
 *
 * $Id: Customizable.java,v 1.1 2007/11/06 19:47:11 cdamus Exp $
 */

package org.eclipse.ocl.options;

import java.util.Collection;
import java.util.Map;

import org.eclipse.ocl.Environment;
import org.eclipse.ocl.EvaluationEnvironment;
import org.eclipse.ocl.util.Adaptable;


/**
 * An {@linkplain Adaptable optional adapter interface} for entities whose
 * behaviour can be customized by clients by the application of {@link Option}s.
 * The primary customizable entities are parsing {@link Environment}s and
 * {@link EvaluationEnvironment}s.
 * 
 * @author Christian W. Damus (cdamus)
 * 
 * @since 1.2
 */
public interface Customizable {
    /**
     * Obtains a copy of my map of options.
     * Options not explicitly set in an environment are inherited from the
     * parent environment, if any, otherwise they are at their
     * {@linkplain Option#getDefaultValue() default values}.
     * 
     * @return the map of options
     */
    Map, Object> getOptions();
    
    /**
     * Obtains the value of the specified option's setting in the my
     * options map.
     * Options not explicitly set in an environment are inherited from the
     * parent environment, if any, otherwise they are at their
     * {@linkplain Option#getDefaultValue() default values}.
     * 
     * @param option the option to query
     * 
     * @return value of the option
     */
     T getValue(Option option);
    
    /**
     * Queries whether the specified boolean-valued option is enabled.
     * This method essentially just puts a nice "is" name on boolean options.
     * Options not explicitly set in an environment are inherited from the
     * parent environment, if any, otherwise they are at their
     * {@linkplain Option#getDefaultValue() default values}.
     * 
     * @param option an option
     * 
     * @return whether the option is enabled
     */
    boolean isEnabled(Option option);
    
    /**
     * Add an option to apply to my behaviour.
     * 
     * @param option the option
     * @param value the option's value
     */
     void setOption(Option option, T value);
    
    /**
     * Adds options to apply to my behaviour.
     * 
     * @param options the options
     */
     void putOptions(Map, ? extends T> options);
    
    /**
     * Removes the specified option.
     * 
     * @param option the option to remove
     * 
     * @return the former value of the option
     */
     T removeOption(Option option);
    
    /**
     * Removes the specified options.
     * 
     * @param options the options to remove
     * 
     * @return the former values of the options
     */
     Map, T> removeOptions(Collection> options);
    
    /**
     * Clears all options.
     * 
     * @return the former values of the options
     */
    Map, Object> clearOptions();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy