001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.internal;
014
015import org.apache.tapestry5.Binding;
016import org.apache.tapestry5.internal.structure.ComponentPageElement;
017import org.apache.tapestry5.runtime.Component;
018
019import java.util.Map;
020
021/**
022 * Operations shared by {@link InternalComponentResources} and {@link ComponentPageElement}. Typically, these means
023 * methods of InternalComponentResources that are delegated to the component page element.
024 */
025public interface InternalComponentResourcesCommon
026{
027    /**
028     * Returns true if the component has finished loading. Initially, this value will be false.
029     * 
030     * @see org.apache.tapestry5.runtime.PageLifecycleListener#containingPageDidLoad()
031     */
032    boolean isLoaded();
033
034    /**
035     * Used during construction of the page to identify the binding for a particular parameter.
036     *
037     */
038    void bindParameter(String parameterName, Binding binding);
039
040    /**
041     * Returns the binding for the given parameter name, or null.
042     * 
043     * @param parameterName
044     *            name of component parameter
045     * @return binding if bound, or null
046     * @since 5.1.0.0
047     */
048    Binding getBinding(String parameterName);
049
050    /**
051     * Returns the mixin instance for the fully qualfied mixin class name.
052     * 
053     * @param mixinClassName
054     *            fully qualified class name
055     * @return IllegalArgumentException if no such mixin is associated with the core component
056     */
057    Component getMixinByClassName(String mixinClassName);
058
059    /**
060     * Constructs a map linking informal parameters to the corresponding bindings.
061     * 
062     * @return map, possible empty
063     */
064    Map<String, Binding> getInformalParameterBindings();
065
066}