Coverage Report - org.apache.tapestry.services.impl.DeferredObjectImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
DeferredObjectImpl
0%
0/11
0%
0/4
1.333
 
 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.impl;
 16  
 
 17  
 import org.apache.hivemind.Location;
 18  
 import org.apache.hivemind.internal.Module;
 19  
 import org.apache.hivemind.schema.Translator;
 20  
 
 21  
 /**
 22  
  * An encapsulation of an invocation of
 23  
  * {@link org.apache.hivemind.schema.Translator#translate(org.apache.hivemind.internal.Module, java.lang.Class, java.lang.String, org.apache.hivemind.Location)},
 24  
  * allowing the actual invocation (and all the object creation, etc., that entails) to be deferred,
 25  
  * or even avoided all together.
 26  
  * 
 27  
  * @author Howard M. Lewis Ship
 28  
  * @since 4.0
 29  
  */
 30  
 public class DeferredObjectImpl implements DeferredObject
 31  
 {
 32  
     private final Module _module;
 33  
 
 34  
     private final Translator _objectTranslator;
 35  
 
 36  
     private final String _objectReference;
 37  
 
 38  
     private final Location _location;
 39  
 
 40  
     private Object _object;
 41  
 
 42  
     public DeferredObjectImpl(final Translator objectTranslator, final Module module,
 43  
             final String objectReference, final Location location)
 44  0
     {
 45  0
         _objectTranslator = objectTranslator;
 46  0
         _module = module;
 47  0
         _objectReference = objectReference;
 48  0
         _location = location;
 49  0
     }
 50  
 
 51  
     public synchronized Object getObject()
 52  
     {
 53  0
         if (_object == null)
 54  0
             _object = _objectTranslator.translate(
 55  
                     _module,
 56  0
                     Object.class,
 57  
                     _objectReference,
 58  
                     _location);
 59  
 
 60  0
         return _object;
 61  
     }
 62  
 
 63  
     public Location getLocation()
 64  
     {
 65  0
         return _location;
 66  
     }
 67  
 }