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

org.omnifaces.component.ParamHolder Maven / Gradle / Ivy

There is a newer version: 4.5.1
Show newest version
/*
 * Copyright OmniFaces
 *
 * 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
 *
 *     https://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.omnifaces.component;

import javax.faces.application.Application;
import javax.faces.component.ValueHolder;
import javax.faces.convert.Converter;

import org.omnifaces.util.Faces;

/**
 * This interface represents a (request) parameter holder which extends {@link ValueHolder} with {@link #getName()}
 * method to obtain the parameter name associated with the parameter value and changes the {@link #getLocalValue()}
 * method to return the original, unconverted value and changes the {@link #getValue()} method to return the value
 * converted to {@link String}. This is used in among others the {@link Faces#getBookmarkableURL(String, java.util.Collection, boolean)}.
 *
 * @author Bauke Scholtz
 * @param  The type of the value.
 * @since 1.7
 */
public interface ParamHolder extends ValueHolder {

	/**
	 * Returns the name of the parameter.
	 * @return The name of the parameter.
	 */
	String getName();

	/**
	 * Returns the original, unconverted value of the parameter.
	 * @return The original, unconverted value of the parameter.
	 */
	@Override
	T getLocalValue();

	/**
	 * Returns the converter, if any.
	 * @return The converter, if any.
	 */
	@Override
	Converter getConverter();

	/**
	 * Returns the value of the parameter as {@link String}. If the converter is set, or if any converter is available by
	 * {@link Application#createConverter(Class)}, passing the value's class, then return the result of
	 * {@link Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, Object)},
	 * otherwise return the {@link Object#toString()} of the value.
	 * @return The value of the parameter as {@link String}.
	 * @see Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, Object)
	 */
	@Override
	String getValue();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy