Coverage Report - org.apache.tapestry.services.ComponentPropertySource
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentPropertySource
N/A 
N/A 
1
 
 1  
 // Copyright 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.services;
 16  
 
 17  
 import java.util.Locale;
 18  
 
 19  
 import org.apache.tapestry.IComponent;
 20  
 import org.apache.tapestry.INamespace;
 21  
 
 22  
 /**
 23  
  * Encapsulates the logic for searching for component meta-data. Deployed as service
 24  
  * tapestry.props.ComponentPropertySource.
 25  
  * <p>
 26  
  * TODO: Adjust name, since it now provides access to namespace properties as well as component
 27  
  * properties.
 28  
  * 
 29  
  * @author Howard M. Lewis Ship
 30  
  * @since 4.0
 31  
  */
 32  
 public interface ComponentPropertySource
 33  
 {
 34  
     /**
 35  
      * Returns the property value for a particular named meta-data property of the component. The
 36  
      * search order is:
 37  
      * <ul>
 38  
      * <li>The component's specification</li>
 39  
      * <li>The specification of the application (or the library containing the component).</li>
 40  
      * <li>The chain of global property sources.</li>
 41  
      * </ul>
 42  
      * 
 43  
      * @return the value of the given key, or null if not found.
 44  
      */
 45  
 
 46  
     String getComponentProperty(IComponent component, String propertyName);
 47  
 
 48  
     /**
 49  
      * Like {@link #getComponentProperty(IComponent, String)}, but the property name will be
 50  
      * localized to the component's current locale (determined from its page). Localizing the
 51  
      * property name means that a suffix may be appended to it. If the fully localized name is not
 52  
      * found, then the locale is generalized (i.e., from "en_UK" to "en" to nothing) until a match
 53  
      * is found.
 54  
      * 
 55  
      * @return the value of the given property name, or null if not found.
 56  
      */
 57  
     String getLocalizedComponentProperty(IComponent component, Locale locale, String propertyName);
 58  
 
 59  
     /**
 60  
      * Returns the property value for a particular named meta-data property of the namespace. The
 61  
      * search order is:
 62  
      * <ul>
 63  
      * <li>The library or application specification for the namespace.</li>
 64  
      * <li>The chain of global property sources.</li>
 65  
      * </ul>
 66  
      * 
 67  
      * @return the value of the given key, or null if not found.
 68  
      */
 69  
 
 70  
     String getNamespaceProperty(INamespace namespace, String propertyName);
 71  
 
 72  
     /**
 73  
      * As with {@link #getLocalizedComponentProperty(IComponent, Locale, String)}, but with a
 74  
      * {@link INamespace}.
 75  
      */
 76  
 
 77  
     String getLocalizedNamespaceProperty(INamespace namespace, Locale locale, String propertyName);
 78  
 }