managedproperty.java

来自「一个使用struts+hibernate+spring开发的完的网站源代码。」· Java 代码 · 共 168 行

JAVA
168
字号
/* * Copyright 2004 The Apache Software Foundation. *  * 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 org.apache.myfaces.config.impl.digester.elements;import javax.faces.context.FacesContext;import javax.faces.el.ValueBinding;import javax.faces.webapp.UIComponentTag;import org.apache.myfaces.config.impl.digester.elements.ListEntries;/** * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a> (latest modification by $Author: matze $) * @author Anton Koinov * * @version $Revision: 1.3 $ $Date: 2004/10/13 11:51:00 $ * $Log: ManagedProperty.java,v $ * Revision 1.3  2004/10/13 11:51:00  matze * renamed packages to org.apache * * Revision 1.2  2004/10/05 22:34:21  dave0000 * bug 1021656 with related improvements * */public class ManagedProperty implements org.apache.myfaces.config.element.ManagedProperty{    private static final ValueBinding DUMMY_VB = new DummyValueBinding();    private int                       _type    = TYPE_UNKNOWN;    private String                    _propertyName;    private String                    _propertyClass;    private ValueBinding              _valueBinding;    private String                    _value;    private MapEntries                _mapEntries;    private ListEntries               _listEntries;    public int getType()    {        return _type;    }    public org.apache.myfaces.config.element.MapEntries getMapEntries()    {        return _mapEntries;    }    public void setMapEntries(MapEntries mapEntries)    {        _mapEntries = mapEntries;        _type = TYPE_MAP;    }    public org.apache.myfaces.config.element.ListEntries getListEntries()    {        return _listEntries;    }    public void setListEntries(ListEntries listEntries)    {        _listEntries = listEntries;        _type = TYPE_LIST;    }    public String getPropertyName()    {        return _propertyName;    }    public void setPropertyName(String propertyName)    {        _propertyName = propertyName;    }    public String getPropertyClass()    {        return _propertyClass;    }    public void setPropertyClass(String propertyClass)    {        _propertyClass = propertyClass;    }    public boolean isNullValue()    {        return _type == TYPE_NULL;    }    public void setNullValue()    {        _type = TYPE_NULL;    }    public void setValue(String value)    {        _value = value;        _type = TYPE_VALUE;    }        public Object getRuntimeValue(FacesContext facesContext)    {        if (_valueBinding == null)        {            _valueBinding =                 UIComponentTag.isValueReference(_value)                ? facesContext.getApplication().createValueBinding(_value)                : DUMMY_VB;        }        return (_valueBinding == DUMMY_VB)            ? _value : _valueBinding.getValue(facesContext);    }    private static class DummyValueBinding extends ValueBinding    {        public String getExpressionString()        {            throw new UnsupportedOperationException();        }        public Class getType(FacesContext facesContext)         {            throw new UnsupportedOperationException();        }        public Object getValue(FacesContext facesContext)         {            throw new UnsupportedOperationException();        }        public boolean isReadOnly(FacesContext facesContext)         {            throw new UnsupportedOperationException();        }        public void setValue(FacesContext facesContext, Object value)         {            throw new UnsupportedOperationException();        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?