本文整理匯總了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());
}
}
}