|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.el Class Expression
java.lang.Object javax.el.Expression
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- MethodExpression, ValueExpression
public abstract class Expression
- extends Object
- implements Serializable
表达式子类
ValueExpression
和 MethodExpression
的基类,它实现两者共同的特性。
所有表达式必须实现 equals()
和 hashCode()
方法,以便可以比较两个表达式的相等性。在此类中它们被重定义为抽象方法,以在子类中强制实现。
所有表达式还必须是 Serializable
,以便它们可以保存和存储。
Expression
还设计为不可改变,从而只需要为任何给定的表达式 String/FunctionMapper
创建一个实例。这允许容器预创建表达式,而且无需在每次对其求值时重新解析它们。
since | JSP 2.1 |
Base class for the expression subclasses ValueExpression
and
MethodExpression
, implementing characterstics common to both.
All expressions must implement the equals()
and
hashCode()
methods so that two expressions can be compared
for equality. They are redefined abstract in this class to force their
implementation in subclasses.
All expressions must also be Serializable
so that they
can be saved and restored.
Expression
s are also designed to be immutable so
that only one instance needs to be created for any given expression
String / FunctionMapper
. This allows a container to pre-create
expressions and not have to re-parse them each time they are evaluated.
- Since:
- JSP 2.1
- See Also:
- Serialized Form
Constructor Summary | |
---|---|
Expression()
|
Method Summary | |
---|---|
abstract boolean |
equals(Object obj)
Determines whether the specified object is equal to this Expression . |
abstract String |
getExpressionString()
Returns the original String used to create this Expression ,
unmodified. |
abstract int |
hashCode()
Returns the hash code for this Expression . |
abstract boolean |
isLiteralText()
Returns whether this expression was created from only literal text. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public
Expression()
英文文档:
Expression
public Expression()
Method Detail |
---|
abstract public String
getExpressionString()
返回用于创建此 Expression
的原始 String(未经修改)。
此方法不仅仅用于调试目的,而且还用于比较(例如,为了确保配置文件中的表达式尚未更改)。
此方法没有提供重新创建表达式的足够信息。两个不同的表达式可以有完全相同的表达式字符串,不同的函数映射。应该使用序列化来保存和存储 Expression
的状态。
return | 原始表达式 String。 |
getExpressionString
public abstract String getExpressionString()
- Returns the original String used to create this
Expression
, unmodified.This is used for debugging purposes but also for the purposes of comparison (e.g. to ensure the expression in a configuration file has not changed).
This method does not provide sufficient information to re-create an expression. Two different expressions can have exactly the same expression string but different function mappings. Serialization should be used to save and restore the state of an
Expression
. - Returns:
- The original expression String.
abstract public boolean
equals(Object obj)
确定指定的对象是否等于此 Expression
。
当且仅当参数不是 null
而是相同类型(ValueExpression
或 MethodExpression
)的 Expression
对象,且解析的表示形式相同时,结果为 true
。
注意,即使两个表达式的表达式 String 不同,这两个表达式也可以相等。例如,如果相应的 FunctionMapper
将 fn1:foo
和 fn2:foo
映射到同一方法,则 ${fn1:foo()}
和 ${fn2:foo()}
相等。
obj |
要测试相等性的 Object 。 |
return |
如果 obj 等于此 Expression ,则返回 true ;否则返回 false 。 |
See also | java.util.Hashtable, equals(java.lang.Object) |
equals
public abstract boolean equals(Object obj)
- Determines whether the specified object is equal to this
Expression
.The result is
true
if and only if the argument is notnull
, is anExpression
object that is the of the same type (ValueExpression
orMethodExpression
), and has an identical parsed representation.Note that two expressions can be equal if their expression Strings are different. For example,
${fn1:foo()}
and${fn2:foo()}
are equal if their correspondingFunctionMapper
s mappedfn1:foo
andfn2:foo
to the same method. - Parameters:
obj
- theObject
to test for equality.- Returns:
true
ifobj
equals thisExpression
;false
otherwise.- See Also:
Hashtable
,Object.equals(java.lang.Object)
abstract public int
hashCode()
返回此 Expression
的哈希码。
有关两个表达式的表达式 String 不同时如何才能相等,请参阅 #equals
方法中的说明。记住,如果根据 equals(Object)
方法,两个对象是相等的,那么对这两个对象中的每个对象调用 hashCode
方法都必须生成相同的整数结果。必须特别注意实现并且正确实现 hashCode
。
return |
此 Expression 的哈希码。 |
See also | equals, java.util.Hashtable, hashCode() |
hashCode
public abstract int hashCode()
- Returns the hash code for this
Expression
.See the note in the
equals(java.lang.Object)
method on how two expressions can be equal if their expression Strings are different. Recall that if two objects are equal according to theequals(Object)
method, then calling thehashCode
method on each of the two objects must produce the same integer result. Implementations must take special note and implementhashCode
correctly. - Returns:
- The hash code for this
Expression
. - See Also:
equals(java.lang.Object)
,Hashtable
,Object.hashCode()
abstract public boolean
isLiteralText()
返回此表达式是否仅根据字面值文本创建。
当且仅当此表达式的表达式字符串是根据不包含非转义的 EL 分隔符(${...}
或 #{...}
)创建时,该方法才返回 true
。
return |
如果此表达式是根据字面值文本创建的,则返回 true ;否则返回 false 。 |
isLiteralText
public abstract boolean isLiteralText()
- Returns whether this expression was created from only literal text.
This method must return
true
if and only if the expression string this expression was created from contained no unescaped EL delimeters (${...}
or#{...}
). - Returns:
true
if this expression was created from only literal text;false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!