Coverage Report - org.apache.tapestry.services.impl.ComponentMessages
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentMessages
0%
0/8
N/A
1
 
 1  
 // Copyright 2004, 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.impl;
 16  
 
 17  
 import java.util.Locale;
 18  
 import java.util.Properties;
 19  
 
 20  
 import org.apache.hivemind.impl.AbstractMessages;
 21  
 import org.apache.hivemind.util.Defense;
 22  
 
 23  
 /**
 24  
  * Implementation of {@link org.apache.hivemind.Messages}. This is basically a wrapper around an
 25  
  * instance of {@link Properties}. This ensures that the properties are, in fact, read-only (which
 26  
  * ensures that they don't have to be synchronized).
 27  
  * 
 28  
  * @author Howard Lewis Ship
 29  
  * @since 2.0.4
 30  
  */
 31  
 
 32  
 public class ComponentMessages extends AbstractMessages
 33  
 {
 34  
     private final Properties _properties;
 35  
 
 36  
     private final Locale _locale;
 37  
 
 38  
     public ComponentMessages(Locale locale, Properties properties)
 39  0
     {
 40  0
         Defense.notNull(locale, "locale");
 41  0
         Defense.notNull(properties, "properties");
 42  
 
 43  0
         _locale = locale;
 44  0
         _properties = properties;
 45  0
     }
 46  
 
 47  
     protected String findMessage(String key)
 48  
     {
 49  0
         return _properties.getProperty(key);
 50  
     }
 51  
 
 52  
     protected Locale getLocale()
 53  
     {
 54  0
         return _locale;
 55  
     }
 56  
 }