001    // Copyright 2008, 2010 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    // http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry5.internal.services;
016    
017    /**
018     * A cache for converting between class names and component (or other) classes. For component classes, ensures that the
019     * class is the transformed class.
020     */
021    public interface ComponentClassCache
022    {
023        /**
024         * Gets the Class instance for the given fully-qualified class name.
025         * 
026         * @param className
027         *            fully qualified class name, or a primitive type name, or an array name (in source format)
028         * @return the class instance
029         */
030        Class forName(String className);
031    
032        /**
033         * Computes the default value for a field of the given type, returns the appropriate
034         * default value. This is typically null, but may be false (for a primitive boolean) or some
035         * version of 0 (for a primitive numeric field). Wrapper types will still be null.
036         * 
037         * @param className
038         *            type of field
039         * @since 5.2.0
040         */
041        Object defaultValueForType(String className);
042    }