Coverage Report - org.apache.myfaces.shared.resource.AliasResourceMetaImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
AliasResourceMetaImpl
0%
0/37
0%
0/20
2.667
 
 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 AliasResourceMetaImpl extends ResourceMetaImpl
 25  
 {
 26  
     private String _realResourceName;
 27  
     
 28  
     private boolean _couldContainValueExpressions;
 29  
 
 30  
     public AliasResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
 31  
             String resourceName, String resourceVersion, String realResourceName, boolean couldContainValueExpressions)
 32  
     {
 33  0
         this(prefix, libraryName, libraryVersion, resourceName, resourceVersion, realResourceName, 
 34  
             couldContainValueExpressions, null);
 35  0
     }
 36  
     
 37  
     public AliasResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
 38  
             String resourceName, String resourceVersion, String realResourceName, 
 39  
             boolean couldContainValueExpressions, String contractName)
 40  
     {
 41  0
         super(prefix, libraryName, libraryVersion,
 42  
             resourceName, resourceVersion, contractName);
 43  0
         _realResourceName = realResourceName;
 44  0
         _couldContainValueExpressions = couldContainValueExpressions;
 45  0
     }
 46  
     
 47  
     public String getRealResourceName()
 48  
     {
 49  0
         return _realResourceName;
 50  
     }
 51  
 
 52  
     public void setRealResourceName(String realResourceName)
 53  
     {
 54  0
         _realResourceName = realResourceName;
 55  0
     }
 56  
     
 57  
     @Override
 58  
     public String getResourceIdentifier()
 59  
     {
 60  0
         StringBuilder builder = new StringBuilder();
 61  0
         boolean firstSlashAdded = false;
 62  0
         if (getLocalePrefix() != null && getLocalePrefix().length() > 0)
 63  
         {
 64  0
             builder.append(getLocalePrefix());
 65  0
             firstSlashAdded = true;
 66  
         }
 67  0
         if (getLibraryName() != null)
 68  
         {
 69  0
             if (firstSlashAdded)
 70  
             {
 71  0
                 builder.append('/');
 72  
             }
 73  0
             builder.append(getLibraryName());
 74  0
             firstSlashAdded = true;
 75  
         }
 76  0
         if (getLibraryVersion() != null)
 77  
         {
 78  0
             if (firstSlashAdded)
 79  
             {
 80  0
                 builder.append('/');
 81  
             }
 82  0
             builder.append(getLibraryVersion());
 83  0
             firstSlashAdded = true;
 84  
         }
 85  0
         if (getRealResourceName() != null)
 86  
         {
 87  0
             if (firstSlashAdded)
 88  
             {
 89  0
                 builder.append('/');
 90  
             }
 91  0
             builder.append(getRealResourceName());
 92  0
             firstSlashAdded = true;
 93  
         }
 94  0
         if (getResourceVersion() != null)
 95  
         {
 96  0
             if (firstSlashAdded)
 97  
             {
 98  0
                 builder.append('/');
 99  
             }
 100  0
             builder.append(getResourceVersion());
 101  0
             builder.append(
 102  
                     getRealResourceName().substring(getRealResourceName().lastIndexOf('.')));
 103  0
             firstSlashAdded = true;
 104  
         }
 105  0
         return builder.toString();
 106  
     }
 107  
 
 108  
     @Override
 109  
     public boolean couldResourceContainValueExpressions()
 110  
     {
 111  0
         return _couldContainValueExpressions;
 112  
     }
 113  
 }