Coverage Report - org.apache.maven.plugin.eclipse.Messages
 
Classes in this File Line Coverage Branch Coverage Complexity
Messages
40% 
N/A 
2
 
 1  
 package org.apache.maven.plugin.eclipse;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *      http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.text.MessageFormat;
 20  
 import java.util.MissingResourceException;
 21  
 import java.util.ResourceBundle;
 22  
 
 23  
 /**
 24  
  * @author <a href="mailto:fgiust@users.sourceforge.net">Fabrizio Giustina</a>
 25  
  * @version $Id: Messages.java 359477 2005-12-28 10:51:19Z fgiust $
 26  
  */
 27  
 public class Messages
 28  
 {
 29  
 
 30  
     private static final String BUNDLE_NAME = "org.apache.maven.plugin.eclipse.messages"; //$NON-NLS-1$
 31  
 
 32  1
     private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
 33  
 
 34  
     private Messages()
 35  0
     {
 36  0
     }
 37  
 
 38  
     public static String getString( String key )
 39  
     {
 40  
         try
 41  
         {
 42  12
             return RESOURCE_BUNDLE.getString( key );
 43  
         }
 44  0
         catch ( MissingResourceException e )
 45  
         {
 46  0
             return '!' + key + '!';
 47  
         }
 48  
     }
 49  
 
 50  
     public static String getString( String key, Object[] params )
 51  
     {
 52  
         try
 53  
         {
 54  303
             return MessageFormat.format( RESOURCE_BUNDLE.getString( key ), params );
 55  
         }
 56  0
         catch ( MissingResourceException e )
 57  
         {
 58  0
             return '!' + key + '!';
 59  
         }
 60  
     }
 61  
 
 62  
     public static String getString( String key, Object param )
 63  
     {
 64  291
         return getString( key, new Object[] { param } );
 65  
     }
 66  
 }