jakarta.faces.component.TransientStateHelper Maven / Gradle / Ivy
Show all versions of myfaces-api Show documentation
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 jakarta.faces.component;
/**
* Define a Map
-like contract
* that makes it easier for components to implement {@link
* TransientStateHolder}. Each {@link UIComponent} in the view will
* return an implementation of this interface from its {@link
* UIComponent#getTransientStateHelper} method.
*
* The values retrieved or saved through
* {@link #getTransient(java.lang.Object) } or
* {@link #putTransient(java.lang.Object, java.lang.Object) }
* will not be preserved between requests.
*
* @since 2.1
*/
public interface TransientStateHelper extends TransientStateHolder
{
/**
* Return the value currently
* associated with the specified key
if any.
*
* @param key the key for which the value should be returned.
* @since 2.1
*/
public Object getTransient(Object key);
/**
* Performs the same logic as {@link #getTransient(java.lang.Object)} but if no value is found, this
* will return the specified defaultValue
* @param key the key for which the value should be returned.
* @param defaultValue the value to return if no value is found in
* the call to get()
.
* @since 2.1
*/
public Object getTransient(Object key, Object defaultValue);
/**
* Return the previously stored value
* and store the specified key/value pair. This is intended to
* store data that would otherwise reside in an instance variable on
* the component.
*
* @param key the key for the value
* @param value the value
* @since 2.1
*/
public Object putTransient(Object key, Object value);
}