本文整理汇总了Java中lucee.runtime.type.Struct.entryIterator方法的典型用法代码示例。如果您正苦于以下问题:Java Struct.entryIterator方法的具体用法?Java Struct.entryIterator怎么用?Java Struct.entryIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucee.runtime.type.Struct
的用法示例。
在下文中一共展示了Struct.entryIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCustomType
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
@Override
public CustomType getCustomType(String strType) {
if(!initCustomTypes) {
if(customTypes==null)
customTypes=new HashMap<String, CustomType>();
// this.type.susi=function(any value){};
Struct sct = Caster.toStruct(get(component,KeyConstants._type,null),null);
if(sct!=null) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
UDF udf;
while(it.hasNext()){
e = it.next();
udf=Caster.toFunction(e.getValue(), null);
if(udf!=null) customTypes.put(e.getKey().getLowerString(), new UDFCustomType(udf));
}
}
}
return customTypes.get(strType.trim().toLowerCase());
}
示例2: getCustomType
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
@Override
public CustomType getCustomType(String strType) {
if(!initCustomTypes) {
if(customTypes==null)
customTypes=new HashMap<String, CustomType>();
// this.type.susi=function(any value){};
Struct sct = Caster.toStruct(get(component,KeyConstants._type,null),null);
if(sct!=null) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
UDF udf;
while(it.hasNext()){
e = it.next();
udf=Caster.toFunction(e.getValue(), null);
if(udf!=null) customTypes.put(e.getKey().getLowerString(), new UDFCustomType(udf));
}
}
initCustomTypes=true;
}
return customTypes.get(strType.trim().toLowerCase());
}
示例3: invoke
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static Object invoke(PageContext pc, Struct sct, UDF udf, Object initalValue) throws PageException {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
while(it.hasNext()){
e = it.next();
initalValue=udf.call(pc, new Object[]{initalValue,e.getKey().getString(),e.getValue(),sct}, true);
}
return initalValue;
}
示例4: toCookies
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static Cookie[] toCookies(Struct sct) throws PageException {
if(sct==null) return new Cookie[0];
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
List<Cookie> cookies=new ArrayList<Cookie>();
Cookie c;
while(it.hasNext()){
e = it.next();
c=ReqRspUtil.toCookie(e.getKey().getString(), Caster.toString(e.getValue()),null);
if(c!=null)cookies.add(c);
else throw new ApplicationException("Cookie name ["+e.getKey().getString()+"] is invalid");
}
return cookies.toArray(new Cookie[cookies.size()]);
}
示例5: _initTagDefaultAttributeValues
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static void _initTagDefaultAttributeValues(Config config,TagLib lib,
Map<Collection.Key, Map<Collection.Key, Object>> tagDefaultAttributeValues, Struct sct, boolean checkNameSpace) {
if(sct==null) return;
Iterator<Entry<Key, Object>> it = sct.entryIterator();
// loop tags
Struct attrs;
TagLibTag tag;
Iterator<Entry<Key, Object>> iit;
Entry<Key, Object> e;
Map<Collection.Key,Object> map;
TagLibTagAttr attr;
String name;
while(it.hasNext()){
e = it.next();
attrs=Caster.toStruct(e.getValue(),null);
if(attrs!=null){
tag=null;
if(checkNameSpace) {
name=e.getKey().getLowerString();
if(StringUtil.startsWithIgnoreCase(name, lib.getNameSpaceAndSeparator())) {
name=name.substring(lib.getNameSpaceAndSeparator().length());
tag = lib.getTag(name);
}
}
else
tag = lib.getTag(e.getKey().getLowerString());
if(tag!=null) {
sct.removeEL(e.getKey());
map=new HashMap<Collection.Key, Object>();
iit = attrs.entryIterator();
while(iit.hasNext()){
e = iit.next();
map.put(KeyImpl.init(e.getKey().getLowerString()),e.getValue());
}
tagDefaultAttributeValues.put(KeyImpl.init(tag.getFullName()), map);
}
}
}
}
示例6: convert
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static SQL convert(String sql, Struct params) throws PageException{
Iterator<Entry<Key, Object>> it = params.entryIterator();
List<SQLItems<NamedSQLItem>> namedItems=new ArrayList<SQLItems<NamedSQLItem>>();
Entry<Key, Object> e;
while(it.hasNext()){
e = it.next();
namedItems.add(toNamedSQLItem(e.getKey().getString(),e.getValue()));
}
return convert(sql, new ArrayList<SQLItems<SQLItem>>(), namedItems);
}
示例7: toDataSources
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static DataSource[] toDataSources(Object o) throws PageException, ClassException {
Struct sct = Caster.toStruct(o);
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
java.util.List<DataSource> dataSources=new ArrayList<DataSource>();
while(it.hasNext()) {
e = it.next();
dataSources.add(toDataSource(e.getKey().getString().trim(), Caster.toStruct(e.getValue())));
}
return dataSources.toArray(new DataSource[dataSources.size()]);
}
示例8: toPair
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static Pair<String,Object>[] toPair(Struct sct, boolean doStringCast) throws PageException {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
Object value;
List<Pair<String,Object>> pairs=new ArrayList<Pair<String,Object>>();
while(it.hasNext()){
e = it.next();
value= e.getValue();
if(doStringCast)value=Caster.toString(value);
pairs.add(new Pair<String,Object>(e.getKey().getString(),value));
}
return pairs.toArray(new Pair[pairs.size()]);
}
示例9: fillForm
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static void fillForm(PageContextImpl _pc, Struct src) throws PageException {
if(src==null) return;
Iterator<Entry<Key, Object>> it = src.entryIterator();
Form trg = _pc.formScope();
Entry<Key, Object> e;
while(it.hasNext()) {
e = it.next();
trg.set(e.getKey(), e.getValue());
}
}
示例10: toMappings
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static Mapping[] toMappings(ConfigWeb cw,Object o, Resource source) throws PageException {
Struct sct = Caster.toStruct(o);
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
java.util.List<Mapping> mappings=new ArrayList<Mapping>();
ConfigWebImpl config=(ConfigWebImpl) cw;
String virtual;
while(it.hasNext()) {
e = it.next();
virtual=translateMappingVirtual(e.getKey().getString());
MappingData md=toMappingData(e.getValue(),source);
mappings.add(config.getApplicationMapping("application",virtual,md.physical,md.archive,md.physicalFirst,false));
}
return mappings.toArray(new Mapping[mappings.size()]);
}
示例11: setPassthrough
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
* @param passthrough The passThrough to set.
* @throws PageException
*/
public void setPassthrough(Object passthrough) throws PageException {
if(passthrough instanceof Struct) {
Struct sct = (Struct) passthrough;
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
while(it.hasNext()) {
e=it.next();
attributes.setEL(e.getKey(),e.getValue());
}
}
else this.passthrough = Caster.toString(passthrough);
//input.setPassThrough(passThrough);
}
示例12: sizeOf
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
* return the size of given struct, size of values + keys
* @param sct
* @return
*/
public static long sizeOf(Struct sct) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
long size = 0;
while(it.hasNext()) {
e = it.next();
size+=SizeOf.size(e.getKey());
size+=SizeOf.size(e.getValue());
}
return size;
}
示例13: createPageContext
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static PageContextImpl createPageContext(PageContext pc, String template, Struct urls, Struct cookies, Struct headers, byte[] body, Charset charset, OutputStream os) throws PageException {
// query string | URL
Entry<Key, Object> e;
StringBuilder sbQS=new StringBuilder();
if(urls!=null) {
Iterator<Entry<Key, Object>> it = urls.entryIterator();
while(it.hasNext()) {
e = it.next();
if(sbQS.length()>0) sbQS.append('&');
sbQS.append(urlenc(e.getKey().getString(),charset));
sbQS.append('=');
sbQS.append(urlenc(Caster.toString(e.getValue()), charset));
}
}
return ThreadUtil.createPageContext(
pc.getConfig(),
os,
pc.getHttpServletRequest().getServerName(),
template,
sbQS.toString(),
CreatePageContext.toCookies(cookies),
CreatePageContext.toPair(headers,true),
body,
CreatePageContext.toPair(new StructImpl(),true),
CreatePageContext.castValuesToString(new StructImpl()),true,-1);
}
示例14: onMissingMethod
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public Object onMissingMethod(PageContext pc, int access,Member member,String name,Object _args[],Struct _namedArgs, boolean superAccess) throws PageException {
Member ommm = access==-1?
getMember(pc,KeyConstants._onmissingmethod,false, superAccess):
getMember(access,KeyConstants._onmissingmethod,false, superAccess);
if(ommm instanceof UDF) {
Argument args=new ArgumentImpl();
if(_args!=null) {
for(int i=0;i<_args.length;i++) {
args.setEL(ArgumentIntKey.init(i+1), _args[i]);
}
}
else if(_namedArgs!=null) {
UDFUtil.argumentCollection(_namedArgs, new FunctionArgument[]{});
Iterator<Entry<Key, Object>> it = _namedArgs.entryIterator();
Entry<Key, Object> e;
while(it.hasNext()){
e = it.next();
args.setEL(e.getKey(),e.getValue());
}
}
//Struct newArgs=new StructImpl(StructImpl.TYPE_SYNC);
//newArgs.setEL(MISSING_METHOD_NAME, name);
//newArgs.setEL(MISSING_METHOD_ARGS, args);
Object[] newArgs=new Object[]{name,args};
return _call(pc,KeyConstants._onmissingmethod,(UDFPlus)ommm,null,newArgs);
}
if(member==null)throw ComponentUtil.notFunction(this, KeyImpl.init(name), null,access);
throw ComponentUtil.notFunction(this, KeyImpl.init(name), member.getValue(),access);
}
示例15: translate
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
* translate all strig values of the struct i script-protected form
* @param sct Struct to translate its values
*/
public static void translate(Struct sct) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
Object value;
while(it.hasNext()) {
e = it.next();
value=e.getValue();
if(value instanceof String) {
sct.setEL(e.getKey(),translate((String)value));
}
}
}