jakarta.faces.component.UIParameter Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.component;
/**
*
* UIParameter is a {@link UIComponent} that represents an optionally named configuration parameter for
* a parent component.
*
*
*
* Parent components should retrieve the value of a parameter by calling getValue()
. In this way, the
* parameter value can be set directly on the component (via setValue()
), or retrieved indirectly via the
* value binding expression.
*
*
*
* In some scenarios, it is necessary to provide a parameter name, in addition to the parameter value that is accessible
* via the getValue()
method. {@link jakarta.faces.render.Renderer}s that support parameter names on their
* nested {@link UIParameter} child components should document their use of this property.
*
*
*/
public class UIParameter extends UIComponentBase {
// ------------------------------------------------------ Manifest Constants
/**
*
* The standard component type for this component.
*
*/
public static final String COMPONENT_TYPE = "jakarta.faces.Parameter";
/**
*
* The standard component family for this component.
*
*/
public static final String COMPONENT_FAMILY = "jakarta.faces.Parameter";
enum PropertyKeys {
name, value, disable
}
// ------------------------------------------------------------ Constructors
/**
*
* Create a new {@link UIParameter} instance with default property values.
*
*/
public UIParameter() {
super();
setRendererType(null);
}
// -------------------------------------------------------------- Properties
@Override
public String getFamily() {
return COMPONENT_FAMILY;
}
/**
*
* Return the optional parameter name for this parameter.
*
*
* @return the name.
*/
public String getName() {
return (String) getStateHelper().eval(PropertyKeys.name);
}
/**
*
* Set the optional parameter name for this parameter.
*
*
* @param name The new parameter name, or null
for no name
*/
public void setName(String name) {
getStateHelper().put(PropertyKeys.name, name);
}
/**
*
* Returns the value
property of the UIParameter
.
*
*
* @return the value.
*/
public Object getValue() {
return getStateHelper().eval(PropertyKeys.value);
}
/**
*
* Sets the value
property of the\ UIParameter
.
*
*
* @param value the new value
*/
public void setValue(Object value) {
getStateHelper().put(PropertyKeys.value, value);
}
/**
*
* Return the value of the disable
directive for this component. This directive determines whether the
* parameter value should be disabled by assigning it a null value. If true, the value
set on this
* component is ignored.
*
*
* @return true
if disabled, false
otherwise.
* @since 2.0
*/
public boolean isDisable() {
return (Boolean) getStateHelper().eval(PropertyKeys.disable, false);
}
/**
*
* Sets the disable
property of the UIParameter
.
*
*
* @param disable the value for the disable flag.
* @since 2.0
*/
public void setDisable(boolean disable) {
getStateHelper().put(PropertyKeys.disable, disable);
}
}