本文整理汇总了Java中lucee.runtime.ext.tag.DynamicAttributes类的典型用法代码示例。如果您正苦于以下问题:Java DynamicAttributes类的具体用法?Java DynamicAttributes怎么用?Java DynamicAttributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DynamicAttributes类属于lucee.runtime.ext.tag包,在下文中一共展示了DynamicAttributes类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttribute
import lucee.runtime.ext.tag.DynamicAttributes; //导入依赖的package包/类
public static void setAttribute(PageContext pc,boolean doDynamic,boolean silently,Tag tag, String name,Object value) throws PageException {
MethodInstance setter = Reflector.getSetter(tag, name.toLowerCase(),value,null);
if(setter!=null) {
try {
setter.invoke(tag);
}
catch (Exception _e) {
if(!(value==null && _e instanceof IllegalArgumentException)) // TODO full null support should allow null, because of that i only suppress in case of an exception
throw Caster.toPageException(_e);
}
}
else if(doDynamic) {
DynamicAttributes da=(DynamicAttributes) tag;
da.setDynamicAttribute(null, name,value);
}
else if(!silently){
throw new ApplicationException("failed to call ["+name+"] on tag "+tag);
}
}
示例2: setAttributes
import lucee.runtime.ext.tag.DynamicAttributes; //导入依赖的package包/类
public static void setAttributes(PageContext pc,Tag tag, Map<Key, Object> att, int attrType) throws PageException {
Iterator<Entry<Key, Object>> it;
Entry<Key, Object> e;
//TagLibTag tlt=null;
if(TagLibTag.ATTRIBUTE_TYPE_DYNAMIC==attrType) {
DynamicAttributes da=(DynamicAttributes) tag;
it = att.entrySet().iterator();
while(it.hasNext()) {
e = it.next();
da.setDynamicAttribute(null, e.getKey(),e.getValue());
}
}
else if(TagLibTag.ATTRIBUTE_TYPE_FIXED==attrType) {
it = att.entrySet().iterator();
while(it.hasNext()) {
e = it.next();
setAttribute(pc,false,true, tag, e.getKey().getLowerString(), e.getValue());
}
}
else if(TagLibTag.ATTRIBUTE_TYPE_MIXED==attrType) {
it = att.entrySet().iterator();
while(it.hasNext()) {
e = it.next();
setAttribute(pc, true,true, tag, e.getKey().getLowerString(), e.getValue());
}
}
}