Coverage Report - org.apache.myfaces.shared.resource.ResourceMetaImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ResourceMetaImpl
0%
0/44
0%
0/20
2
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  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,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.shared.resource;
 20  
 
 21  
 /**
 22  
  * Contains the metadata information to reference a resource 
 23  
  */
 24  
 public class ResourceMetaImpl extends ResourceMeta
 25  
 {
 26  
 
 27  
     private final String _prefix;
 28  
     private final String _libraryName;
 29  
     private final String _libraryVersion;
 30  
     private final String _resourceName;
 31  
     private final String _resourceVersion;
 32  
     private final String _contractName;
 33  
 
 34  
     public ResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
 35  
             String resourceName, String resourceVersion)
 36  
     {
 37  0
         this(prefix, libraryName, libraryVersion, resourceName, resourceVersion, null);
 38  0
     }
 39  
     
 40  
     public ResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
 41  
             String resourceName, String resourceVersion, String contractName)
 42  0
     {
 43  0
         _prefix = prefix;
 44  0
         _libraryName = libraryName;
 45  0
         _libraryVersion = libraryVersion;
 46  0
         _resourceName = resourceName;
 47  0
         _resourceVersion = resourceVersion;
 48  0
         _contractName = contractName;
 49  0
     }
 50  
 
 51  
     public String getLibraryName()
 52  
     {
 53  0
         return _libraryName;
 54  
     }    
 55  
     
 56  
     public String getResourceName()
 57  
     {
 58  0
         return _resourceName;
 59  
     }    
 60  
 
 61  
     public String getLocalePrefix()
 62  
     {
 63  0
         return _prefix;
 64  
     }
 65  
 
 66  
     public String getLibraryVersion()
 67  
     {
 68  0
         return _libraryVersion;
 69  
     }
 70  
 
 71  
     public String getResourceVersion()
 72  
     {
 73  0
         return _resourceVersion;
 74  
     }
 75  
 
 76  
     public String getContractName()
 77  
     {
 78  0
         return _contractName;
 79  
     }
 80  
     
 81  
     @Override
 82  
     public String getResourceIdentifier()
 83  
     {
 84  0
         StringBuilder builder = new StringBuilder();
 85  0
         boolean firstSlashAdded = false;
 86  0
         if (_prefix != null && _prefix.length() > 0)
 87  
         {
 88  0
             builder.append(_prefix);
 89  0
             firstSlashAdded = true;
 90  
         }
 91  0
         if (_libraryName != null)
 92  
         {
 93  0
             if (firstSlashAdded)
 94  
             {
 95  0
                 builder.append('/');
 96  
             }
 97  0
             builder.append(_libraryName);
 98  0
             firstSlashAdded = true;
 99  
         }
 100  0
         if (_libraryVersion != null)
 101  
         {
 102  0
             if (firstSlashAdded)
 103  
             {
 104  0
                 builder.append('/');
 105  
             }
 106  0
             builder.append(_libraryVersion);
 107  0
             firstSlashAdded = true;
 108  
         }
 109  0
         if (_resourceName != null)
 110  
         {
 111  0
             if (firstSlashAdded)
 112  
             {
 113  0
                 builder.append('/');
 114  
             }
 115  0
             builder.append(_resourceName);
 116  0
             firstSlashAdded = true;
 117  
         }
 118  0
         if (_resourceVersion != null)
 119  
         {
 120  0
             if (firstSlashAdded)
 121  
             {
 122  0
                 builder.append('/');
 123  
             }
 124  0
             builder.append(_resourceVersion);
 125  0
             builder.append(
 126  
                     _resourceName.substring(_resourceName.lastIndexOf('.')));
 127  0
             firstSlashAdded = true;
 128  
         }
 129  
 
 130  0
         return builder.toString();
 131  
     }
 132  
 
 133  
     @Override
 134  
     public boolean couldResourceContainValueExpressions()
 135  
     {
 136  0
         return false;
 137  
     }
 138  
 
 139  
 }