⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enumresolver.java

📁 JavaeeTutorial5的源代码。
💻 JAVA
字号:
/* * Copyright 2007 Sun Microsystems, Inc. * All rights reserved.  You may not modify, use, * reproduce, or distribute this software except in * compliance with  the terms of the License at: * http://developer.sun.com/berkeley_license.html */package com.sun.tutorial.javaee.dukesbank.web;import javax.el.ELResolver;import javax.el.ELContext;import javax.el.PropertyNotFoundException;import java.beans.FeatureDescriptor;import java.util.Iterator;import java.util.Collections;/** *  An <code>ELResolver</code> implementation to detect instances * of <code>EnumManagedBean</code> and invoke the <code>getEnum()</code> * method. */public class EnumResolver extends ELResolver {    public Object getValue(        ELContext elContext,        Object base,        Object property) {        if (((base != null) && (property != null))                && base instanceof EnumManagedBean) {            elContext.setPropertyResolved(true);            return ((EnumManagedBean) base).getEnum(property.toString());        }        return null;    }    public Class<?> getCommonPropertyType(        ELContext elContext,        Object base) {        return EnumManagedBean.class;    }    public Class<?> getType(        ELContext elContext,        Object base,        Object property) {        if (((base != null) && (property != null))                && base instanceof EnumManagedBean) {            elContext.setPropertyResolved(true);            throw new PropertyNotFoundException();        }        return null;    }    public void setValue(        ELContext elContext,        Object base,        Object property,        Object value) {        if (((base != null) && (property != null))                && base instanceof EnumManagedBean) {            elContext.setPropertyResolved(true);            throw new PropertyNotFoundException(); // readonly        }    }    public boolean isReadOnly(        ELContext elContext,        Object base,        Object property) {        if (((base != null) && (property != null))                && base instanceof EnumManagedBean) {            elContext.setPropertyResolved(true);            return true; // readonly        }        return false;    }    public Iterator<FeatureDescriptor> getFeatureDescriptors(        ELContext elContext,        Object base) {        return Collections.<FeatureDescriptor>emptyList()                          .iterator();    }}

⌨️ 快捷键说明

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