本文整理汇总了Java中javax.el.ValueExpression.isLiteralText方法的典型用法代码示例。如果您正苦于以下问题:Java ValueExpression.isLiteralText方法的具体用法?Java ValueExpression.isLiteralText怎么用?Java ValueExpression.isLiteralText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.el.ValueExpression
的用法示例。
在下文中一共展示了ValueExpression.isLiteralText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
protected void setProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
bean.setProperty(key, expression.getValue(FacesContext.getCurrentInstance().getELContext()));
}
else
{
bean.setValueExpression(key, expression);
}
}
示例2: setStringArrayProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type java.lang.String[]. If the value
* is an EL expression, it will be stored as a ValueExpression.
* Otherwise, it will parsed as a whitespace-separated series
* of strings.
* Null values are ignored.
*/
protected void setStringArrayProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
bean.setProperty(key, TagUtils.parseNameTokens(
expression.getValue(FacesContext.getCurrentInstance().getELContext())));
}
else
{
// Support coercion from a string to a string array
expression = new StringArrayValueExpression(expression);
bean.setValueExpression(key, expression);
}
}
示例3: setStringListProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type java.util.List<java.lang.String>. If the value
* is an EL expression, it will be stored as a ValueExpression.
* Otherwise, it will parsed as a whitespace-separated series
* of strings.
* Null values are ignored.
*/
protected void setStringListProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
bean.setProperty(key, TagUtils.parseNameTokensAsList(
expression.getValue(FacesContext.getCurrentInstance().getELContext())));
}
else
{
bean.setValueExpression(key, expression);
}
}
示例4: setStringSetProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type java.util.Set<java.lang.String>. If the value
* is an EL expression, it will be stored as a ValueExpression.
* Otherwise, it will parsed as a whitespace-separated series
* of strings.
* Null values are ignored.
*/
protected void setStringSetProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
bean.setProperty(key, TagUtils.parseNameTokensAsSet(
expression.getValue(FacesContext.getCurrentInstance().getELContext())));
}
else
{
bean.setValueExpression(key, expression);
}
}
示例5: setDateProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type java.util.Date. If the value
* is an EL expression, it will be stored as a ValueExpression.
* Otherwise, it will parsed as an ISO 8601 date (yyyy-MM-dd).
* Null values are ignored.
*/
protected void setDateProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
bean.setProperty(key, _parseISODate(
expression.getValue(FacesContext.getCurrentInstance().getELContext())));
}
else
{
bean.setValueExpression(key, expression);
}
}
示例6: setValueExpression
import javax.el.ValueExpression; //导入方法依赖的package包/类
@Override
public void setValueExpression(String name,
ValueExpression expression)
{
if (name == null)
throw new NullPointerException();
if ((expression != null) && expression.isLiteralText())
{
ELContext context =
FacesContext.getCurrentInstance().getELContext();
getAttributes().put(name, expression.getValue(context));
}
else
{
PropertyKey key = getPropertyKey(name);
getFacesBean().setValueExpression(key, expression);
}
}
示例7: setValue
import javax.el.ValueExpression; //导入方法依赖的package包/类
public void setValue(ValueExpression value)
{
if (value.isLiteralText())
setProperty(VALUE_KEY, value.getValue(FacesContext.getCurrentInstance().getELContext()));
else
setValueExpression(VALUE_KEY, value);
}
示例8: setItems
import javax.el.ValueExpression; //导入方法依赖的package包/类
public void setItems(ValueExpression items)
{
if (items.isLiteralText())
throw new IllegalArgumentException(_LOG.getMessage(
"MUST_BE_SIMPLE_JSF_EL_EXPRESSION"));
_items = items;
}
示例9: setNumberProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type java.lang.Number. If the value
* is an EL expression, it will be stored as a ValueBinding.
* Otherwise, it will parsed with Integer.valueOf() or Double.valueOf() .
* Null values are ignored.
*/
protected void setNumberProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
Object value = expression.getValue(FacesContext.getCurrentInstance().getELContext());
if (value != null)
{
if (value instanceof Number)
{
bean.setProperty(key, value);
}
else
{
String valueStr = value.toString();
if(valueStr.indexOf('.') == -1)
bean.setProperty(key, Integer.valueOf(valueStr));
else
bean.setProperty(key, Double.valueOf(valueStr));
}
}
}
else
{
bean.setValueExpression(key, expression);
}
}
示例10: setMaxDateProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type java.util.Date. If the value
* is an EL expression, it will be stored as a ValueBinding.
* Otherwise, it will parsed as an ISO 8601 date (yyyy-MM-dd)
* and the time components (hour, min, second, millisecond) maximized.
* Null values are ignored.
*/
protected void setMaxDateProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
Date d = _parseISODate(expression.getValue(FacesContext.getCurrentInstance().getELContext()));
Calendar c = Calendar.getInstance();
TimeZone tz = RequestContext.getCurrentInstance().getTimeZone();
if (tz != null)
c.setTimeZone(tz);
c.setTime(d);
// Original value had 00:00:00 for hours,mins, seconds now maximize those
// to get the latest time value for the date supplied.
c.set (Calendar.HOUR_OF_DAY, 23);
c.set (Calendar.MINUTE, 59);
c.set (Calendar.SECOND, 59);
c.set (Calendar.MILLISECOND, 999);
bean.setProperty(key, c.getTime());
}
else
{
bean.setValueExpression(key, expression);
}
}
示例11: setIntArrayProperty
import javax.el.ValueExpression; //导入方法依赖的package包/类
/**
* Set a property of type int[]. If the value
* is an EL expression, it will be stored as a ValueExpression.
* Otherwise, it will parsed as a whitespace-separated series
* of ints.
* Null values are ignored.
*/
protected void setIntArrayProperty(
FacesBean bean,
PropertyKey key,
ValueExpression expression)
{
if (expression == null)
return;
if (expression.isLiteralText())
{
Object value = expression.getValue(FacesContext.getCurrentInstance().getELContext());
if (value != null)
{
String[] strings = TagUtils.parseNameTokens(value);
final int[] ints;
if (strings != null)
{
try
{
ints = new int[strings.length];
for(int i=0; i<strings.length; i++)
{
int j = Integer.parseInt(strings[i]);
ints[i] = j;
}
}
catch (NumberFormatException e)
{
_LOG.severe("CANNOT_CONVERT_INTO_INT_ARRAY",value);
_LOG.severe(e);
return;
}
}
}
}
else
{
bean.setValueExpression(key, expression);
}
}