Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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 org.apache.myfaces.trinidad.bean;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.component.PartialStateHolder;
import javax.faces.component.StateHolder;
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import org.apache.myfaces.trinidad.bean.util.FlaggedPropertyMap;
import org.apache.myfaces.trinidad.bean.util.StateUtils;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
/**
* Base implementation of FacesBean.
*
*/
abstract public class FacesBeanImpl implements FacesBean
{
public FacesBeanImpl()
{
}
/**
* Get the type of a FacesBean
*/
// TODO Use auto "TYPE" detection?
abstract public Type getType();
final public Object getProperty(PropertyKey key)
{
Object o = getLocalProperty(key);
if (o != null)
return o;
// Look for a binding if and only if the key supports bindings
if (key.getSupportsBinding())
{
ValueExpression expression = getValueExpression(key);
if (expression != null)
{
FacesContext context = FacesContext.getCurrentInstance();
return expression.getValue(context.getELContext());
}
}
return null;
}
/**
* {@inheritDoc}
*/
final public Object getRawProperty(PropertyKey key)
{
Object local = getLocalProperty(key);
if (local != null)
return local;
// Look for a binding if and only if the key supports bindings
return key.getSupportsBinding() ? getValueExpression(key) : null;
}
// TODO Need *good* way of hooking property-sets; it's
// currently not called from state restoring, so really, it shouldn't
// be used as a hook, but EditableValueBase currently
// requires hooking this method.
public void setProperty(PropertyKey key, Object value)
{
_checkNotListKey(key);
setPropertyImpl(key, value);
}
final public Object getLocalProperty(PropertyKey key)
{
_checkNotListKey(key);
return getLocalPropertyImpl(key);
}
final public ValueExpression getValueExpression(PropertyKey key)
{
_checkNotListKey(key);
PropertyMap map = _getExpressionsMap(false);
if (map == null)
return null;
return (ValueExpression) map.get(key);
}
final public void setValueExpression(PropertyKey key,
ValueExpression expression)
{
_checkNotListKey(key);
if (!key.getSupportsBinding())
{
throw new IllegalArgumentException(_LOG.getMessage(
"CANNOT_FIND_PROPERTY", key.getName()));
}
if (expression == null)
{
PropertyMap map = _getExpressionsMap(false);
if (map != null)
map.remove(key);
}
else
{
_getExpressionsMap(true).put(key, expression);
}
}
@SuppressWarnings("deprecation")
final public ValueBinding getValueBinding(PropertyKey key)
{
ValueExpression ve = getValueExpression(key);
if (ve == null)
{
return null;
}
else
{
// wrap the ValueExpression if necessary
return ValueExpressionValueBinding.getValueBinding(ve);
}
}
@SuppressWarnings("deprecation")
final public void setValueBinding(PropertyKey key, ValueBinding binding)
{
ValueExpression ve;
if (binding == null)
{
ve = null;
}
else
{
ve = ValueBindingValueExpression.getValueExpression(binding);
}
setValueExpression(key, ve);
}
@SuppressWarnings("unchecked")
final public void addEntry(PropertyKey listKey, Object value)
{
_checkListKey(listKey);
List