    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.transform;
    014
    015import org.apache.tapestry5.Binding;
    016import org.apache.tapestry5.annotations.Parameter;
    017import org.apache.tapestry5.internal.InternalComponentResources;
    018import org.apache.tapestry5.ioc.services.TypeCoercer;
    019import org.apache.tapestry5.plastic.FieldConduit;
    020
    021/**
    022 * A facade around {@link Binding} and {@link InternalComponentResources} that is used to instrument
    023 * fields with the {@link Parameter} annotation. Extends {@link FieldConduit} so that
    024 * the get() method implicitly coerces the value to the field's type.
    025 *
    026 * {@link #get(Object, org.apache.tapestry5.plastic.InstanceContext)} will read from the underlying {@link Binding} and used the {@link TypeCoercer} coerce the value to the
    027 * parameter field's type. get() also includes a null value check (as per {@link Parameter#allowNull()}.
    028 *
    029 * {@link #set(Object, org.apache.tapestry5.plastic.InstanceContext, Object)} pushes the value into the binding.
    030 *
    031 * @since 5.2.0
    032 */
    033public interface ParameterConduit extends FieldConduit<Object>
    034{
    035    /**
    036     * Determines if the parameter is actually bound.
    037     *
    038     * @return true if bound
    039     */
    040    boolean isBound();
    041
    042    /**
    043     * Resets the conduit, clearing any <em>temporarily</em> cached data (from a non-invariant {@link Binding}).
    044     */
    045    void reset();
    046}