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

org.apache.tapestry.services.MasterObjectProvider 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.services;

import org.apache.tapestry.ioc.AnnotationProvider;
import org.apache.tapestry.ioc.ObjectLocator;
import org.apache.tapestry.ioc.ObjectProvider;

/**
 * Rolls up a number of {@link ObjectProvider}, but allows for the case where no object may be
 * provided.
 */
public interface MasterObjectProvider
{
    /**
     * Provides an object based on an expression. The process of providing objects occurs within a
     * particular context, which will typically be a service builder method, service
     * contributor method, or service decorator method. The locator parameter provides access to the
     * services visible to that context.
     * 

* When the value is required and no {@link ObjectProvider} provided a non-null value, then * {@link ObjectLocator#getService(Class)} is invoked, to provide a uniquely matching service, * or throw a failure exception if no single service can be found. * * @param objectType the expected object type * @param annotationProvider provides access to annotations (typically, the field or parameter to which an * injection-related annotation is attached); annotations on the field or parameter * may also be used when resolving the desired object * @param locator locator for the context in which the provider is being used * @param required if true (normal case) a value must be provided; if false then it is allowed for no * ObjectProvider to provide a value, and this method may return null to indicate the * failure * @param * @return the requested object, or null if this object provider can not supply an object * @throws RuntimeException if the expression can not be evaluated, or the type of object identified is not * assignable to the type specified by the objectType parameter */ T provide(Class objectType, AnnotationProvider annotationProvider, ObjectLocator locator, boolean required); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy