/*
* Copyright (c) 2003 The Visigoth Software Society. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Visigoth Software Society (http://www.visigoths.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. Neither the name "FreeMarker", "Visigoth", nor any of the names of the
* project contributors may be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact visigoths@visigoths.org.
*
* 5. Products derived from this software may not be called "FreeMarker" or "Visigoth"
* nor may "FreeMarker" or "Visigoth" appear in their names
* without prior written permission of the Visigoth Software Society.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE VISIGOTH SOFTWARE SOCIETY OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Visigoth Software Society. For more
* information on the Visigoth Software Society, please see
* http://www.visigoths.org/
*/
package freemarker.ext.beans;
import java.beans.BeanInfo;
import java.beans.IndexedPropertyDescriptor;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;
import java.io.InputStream;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.StringTokenizer;
import freemarker.core._ConcurrentMapFactory;
import freemarker.ext.util.IdentityHashMap;
import freemarker.ext.util.ModelCache;
import freemarker.ext.util.ModelFactory;
import freemarker.ext.util.WrapperTemplateModel;
import freemarker.log.Logger;
import freemarker.template.AdapterTemplateModel;
import freemarker.template.ObjectWrapper;
import freemarker.template.TemplateBooleanModel;
import freemarker.template.TemplateCollectionModel;
import freemarker.template.TemplateDateModel;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateNumberModel;
import freemarker.template.TemplateScalarModel;
import freemarker.template.TemplateSequenceModel;
import freemarker.template.utility.ClassUtil;
import freemarker.template.utility.Collections12;
import freemarker.template.utility.SecurityUtilities;
import freemarker.template.utility.UndeclaredThrowableException;
/**
* Utility class that provides generic services to reflection classes.
* It handles all polymorphism issues in the {@link #wrap(Object)} and {@link #unwrap(TemplateModel)} methods.
* @author Attila Szegedi
*/
public class BeansWrapper implements ObjectWrapper
{
static final Object CAN_NOT_UNWRAP = new Object();
private static final Class BIGINTEGER_CLASS = java.math.BigInteger.class;
private static final Class BOOLEAN_CLASS = Boolean.class;
private static final Class CHARACTER_CLASS = Character.class;
private static final Class COLLECTION_CLASS = Collection.class;
private static final Class DATE_CLASS = Date.class;
private static final Class HASHADAPTER_CLASS = HashAdapter.class;
private static final Class ITERABLE_CLASS;
private static final Class LIST_CLASS = List.class;
private static final Class MAP_CLASS = Map.class;
private static final Class NUMBER_CLASS = Number.class;
private static final Class OBJECT_CLASS = Object.class;
private static final Class SEQUENCEADAPTER_CLASS = SequenceAdapter.class;
private static final Class SET_CLASS = Set.class;
private static final Class SETADAPTER_CLASS = SetAdapter.class;
private static final Class STRING_CLASS = String.class;
static {
Class iterable;
try {
iterable = Class.forName("java.lang.Iterable");
}
catch(ClassNotFoundException e) {
// We're running on a pre-1.5 JRE
iterable = null;
}
ITERABLE_CLASS = iterable;
}
// When this property is true, some things are stricter. This is mostly to
// catch anomalous things in development that can otherwise be valid situations
// for our users.
private static final boolean DEVELOPMENT = "true".equals(SecurityUtilities.getSystemProperty("freemarker.development"));
private static final Constructor ENUMS_MODEL_CTOR = enumsModelCtor();
private static final Logger logger = Logger.getLogger("freemarker.beans");
private static final Set UNSAFE_METHODS = createUnsafeMethodsSet();
static final Object GENERIC_GET_KEY = new Object();
private static final Object CONSTRUCTORS = new Object();
private static final Object ARGTYPES = new Object();
private static final boolean javaRebelAvailable = isJavaRebelAvailable();
/**
* The default instance of BeansWrapper
*/
private static final BeansWrapper INSTANCE = new BeansWrapper();
/**
* Used for synchronization by {@link #genericClassIntrospectionCache},
* {@link #staticModels} and {@link #enumModels} (and by any similar future
* fields). The primary goal of using a common monitor is to prevent
* deadlocks when these objects call each other.
*/
private final Object sharedClassIntrospectionCacheLock = new Object();
/**
* This is called the "generic" class introspection cache because when the
* public API simply says "introspection cache" it refers to the sum of all
* caches. The other less generic caches are in {@link #staticModels}
* and {@link #enumModels}.
*/
private final Map/*<Class, Map<String, Object>>*/ genericClassIntrospectionCache
= _ConcurrentMapFactory.newMaybeConcurrentHashMap();
private final boolean isGenericClassIntrospectionCacheConcurrentMap
= _ConcurrentMapFacto
没有合适的资源?快使用搜索试试~ 我知道了~
freemarker-2.3.20.tar.gz
5星 · 超过95%的资源 需积分: 10 29 下载量 23 浏览量
2013-07-04
12:23:23
上传
评论
收藏 2.61MB GZ 举报
温馨提示
共1262个文件
html:576个
java:392个
ftl:115个
FreeMarker是一个用Java语言编写的模板引擎,它基于模板来生成文本输出。FreeMarker与Web容器无关,即在Web运行时,它并不知道Servlet或HTTP。它不仅可以用作表现层的实现技术,而且还可以用于生成XML,JSP或Java 等。
资源推荐
资源详情
资源评论
收起资源包目录
freemarker-2.3.20.tar.gz (1262个子文件)
ast-1.ast 6KB
osgi.bnd 2KB
docgen.cjson 557B
.classpath 1KB
stylesheet.css 11KB
docgen.css 4KB
web-app_2_3.dtd 30KB
web-app_2_2.dtd 16KB
web-jsptaglibrary_1_2.dtd 12KB
web-jsptaglibrary_1_1.dtd 6KB
sequence-builtins.ftl 9KB
iso8601.ftl 5KB
comparisons.ftl 5KB
existence-operators.ftl 4KB
string-builtins-regexps.ftl 4KB
string-builtins2.ftl 3KB
overloaded-methods-23bc.ftl 3KB
string-builtins1.ftl 3KB
boolean-formatting.ftl 3KB
transforms.ftl 3KB
switch.ftl 3KB
if.ftl 2KB
boolean.ftl 2KB
number-literal.ftl 2KB
number-math-builtins.ftl 2KB
macros.ftl 2KB
multimodels.ftl 2KB
hashliteral.ftl 1KB
numerical-cast.ftl 1KB
listliteral.ftl 1KB
faq2html.ftl 1KB
whitespace-trim.ftl 1KB
escapes.ftl 1KB
variables.ftl 1KB
beans.ftl 1023B
stringliteral.ftl 1005B
dateformat.ftl 971B
recover.ftl 878B
iterators.ftl 863B
xmlns3.ftl 839B
xmlns4.ftl 839B
noparse.ftl 837B
number-to-date.ftl 801B
xml.ftl 791B
compress.ftl 778B
string-builtin-coercion.ftl 748B
bean-maps.ftl 743B
form.ftl 737B
varargs.ftl 728B
index.ftl 709B
classic-compatible.ftl 707B
var-layers.ftl 702B
index.ftl 696B
exthash.ftl 670B
type-builtins.ftl 663B
encoding-builtins.ftl 647B
list.ftl 613B
common.ftl 586B
common.ftl 571B
precedence.ftl 571B
loopvariable.ftl 555B
form.ftl 550B
root.ftl 549B
xmlns1.ftl 545B
specialvars.ftl 540B
classic-compatible-mode2.ftl 509B
arithmetic.ftl 507B
nested.ftl 490B
comment.ftl 482B
hashconcat.ftl 466B
import.ftl 449B
stringbimethods.ftl 447B
include.ftl 436B
ast-1.ftl 417B
add.ftl 409B
identifier.ftl 404B
xmlns5.ftl 375B
add.ftl 372B
include-subdir.ftl 342B
included.ftl 323B
include2.ftl 321B
newlines2.ftl 311B
output-encoding2.ftl 300B
output-encoding3.ftl 300B
logging.ftl 295B
output-encoding1.ftl 294B
new-optin.ftl 290B
number-format.ftl 280B
default-xmlns.ftl 268B
interpret.ftl 262B
macros2.ftl 238B
varlayers_lib.ftl 233B
lastcharacter.ftl 230B
import_lib.ftl 227B
string-builtins-ici-2.3.19.ftl 223B
default.ftl 219B
charset-in-header.ftl 214B
new-optin.ftl 206B
new-safer.ftl 193B
new-defaultresolver.ftl 193B
共 1262 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
- NancyDDD72015-01-14不错,可以用。
- jkwmscq2013-11-03不错,最新版本的。
- fengchunyu0072013-08-23不错~很有用~
bestbanana
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 福袋点点.apk
- Lengyel E. - Foundations of Game Engine Development(卷一卷二合集).zip
- ### 词向量的介绍、使用技巧和优缺点的文章
- 基于STM32F103CBT6单片机GC65+MP2625+CC1101 GPSTrack模块板硬件(原理图+PCB)工程文件
- ### 通道处理过程模拟概念、优缺点和使用技巧
- ### MyBatis动态SQL介绍说明、使用技巧和优缺点
- 上传下载仿163网盘无刷新文件上传 for Jsp-fileupload-jsp.rar
- VMware Workstation业界非常稳定且安全的桌面虚拟机软件-计算机上运行多个操作系统,支持Windows、DOS等
- 基于STM8L101F3P6单片机+LY2508A33P+CC1100遥控器硬件(原理图+PCB)工程文件.zip
- 上传下载WAP图铃下载系统-unimg.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功