001// Copyright 2009 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5;
016
017/**
018 * Extension to {@link org.apache.tapestry5.Asset} that adds a method to determine if the asset is invariant or not.
019 * {@link org.apache.tapestry5.services.AssetFactory} instances should ideally return Asset2 objects, not Asset. This is
020 * only of primary interest to the {@link org.apache.tapestry5.internal.bindings.AssetBindingFactory}, as it determines
021 * the invariance of the binding from the asset (and assumes variant unless the asset object implements this
022 * interface).
023 *
024 * @since 5.1.0.0
025 */
026public interface Asset2 extends Asset
027{
028    /**
029     * Returns true if the Asset is invariant (meaning that it returns the same value from {@link Asset#toClientURL()}
030     * at all times). Most Assets are invariant. Assets that are used as binding values will be cached more aggressively by Tapestry if they are
031     * invariant.
032     *
033     * @return true if invariant
034     * @see org.apache.tapestry5.services.AssetPathConverter#isInvariant()
035     * @see Binding#isInvariant()
036     */
037    boolean isInvariant();
038}