All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tapestry.ioc.ServiceBinder Maven / Gradle / Ivy

// Copyright 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.apache.tapestry.ioc;

import org.apache.tapestry.ioc.annotations.Scope;
import org.apache.tapestry.ioc.def.ServiceDef;

/**
 * Allows a module to bind service interfaces to service implementation classes in support of
 * autobuilding services. A ServiceBinder is passed to to a method with the following signature:
 * public static void bind(ServiceBinder binder). This is an adaptation of ideas
 * from Guice.
 */
public interface ServiceBinder
{
    /**
     * Defines a service in terms of an implementation class, without a service interface. In this
     * case, the service will not be proxiable (proxying requires a service interface) and
     * {@link ServiceDef#getServiceInterface()} will return the implementation class. In this
     * situation, the service will not be proxied; it will be instantiated fully on first reference
     * (ignoring its scope, if any) and will not be decorated.
     *
     * @param 
     * @param implementationClass
     * @return
     */
     ServiceBindingOptions bind(Class implementationClass);

    /**
     * Binds the service interface to a service implementation class. The default service name is
     * the unqualified name of the service interface. The default service scope is "singleton",
     * unless the service implementation class includes the {@link Scope} annotation.
     *
     * @param 
     * @param serviceInterface      service interface (used when locating services, and when building proxies)
     * @param serviceImplementation implementation class that implements the service interface
     * @return binding options, used to specify additional details about the service.
     */
     ServiceBindingOptions bind(Class serviceInterface,
                                   Class serviceImplementation);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy