com.ocpsoft.pretty.faces.spi.ELBeanNameResolver Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2010 Lincoln Baxter, III
*
* 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 com.ocpsoft.pretty.faces.spi;
import javax.servlet.ServletContext;
import com.ocpsoft.pretty.faces.util.ServiceLoader;
/**
*
* Implementations of this interfaces help PrettyFaces in getting the name a
* bean has in the EL context.
*
*
*
* Implementations are looked up at runtime via the {@link ServiceLoader}
* mechanism.
*
*
* @author Christian Kaltepoth
*
*/
public interface ELBeanNameResolver
{
/**
* This method is called once prior to calls of {@link #getBeanName(Class)}
* and should be used to initialize the resolver. Implementations must return
* true
when the initialization succeeded. If false
* is returned, the resolver will be disabled!
*
* @param servletContext The {@link ServletContext}
* @param classLoader A {@link ClassLoader} to use
* @return true
if initialization succeeded. false
* will disable the resolver.
*/
public boolean init(ServletContext servletContext, ClassLoader classLoader);
/**
* This method returns the name of a bean with the supplied type. The method
* MUST return null
, if it cannot resolve the bean name or isn't
* absolutely certain about it.
*
* @param clazz Class of the bean
* @return The bean name or null
.
*/
public String getBeanName(Class> clazz);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy