Clover coverage report - Code Coverage for tapestry release 4.0-beta-6
Coverage timestamp: Wed Sep 7 2005 18:41:34 EDT
file stats: LOC: 67   Methods: 3
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DeferredObjectImpl.java 100% 100% 100% 100%
coverage
 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  1396 public DeferredObjectImpl(final Translator objectTranslator, final Module module,
 43    final String objectReference, final Location location)
 44    {
 45  1396 _objectTranslator = objectTranslator;
 46  1396 _module = module;
 47  1396 _objectReference = objectReference;
 48  1396 _location = location;
 49    }
 50   
 51  1357 public synchronized Object getObject()
 52    {
 53  1357 if (_object == null)
 54  1355 _object = _objectTranslator.translate(
 55    _module,
 56    Object.class,
 57    _objectReference,
 58    _location);
 59   
 60  1357 return _object;
 61    }
 62   
 63  2 public Location getLocation()
 64    {
 65  2 return _location;
 66    }
 67    }