本文整理汇总了Java中lucee.runtime.type.Struct.setEL方法的典型用法代码示例。如果您正苦于以下问题:Java Struct.setEL方法的具体用法?Java Struct.setEL怎么用?Java Struct.setEL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucee.runtime.type.Struct
的用法示例。
在下文中一共展示了Struct.setEL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToSimpleMap
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static Struct convertToSimpleMap(String paramsStr) {
paramsStr=paramsStr.trim();
if(!StringUtil.startsWith(paramsStr, '{') || !StringUtil.endsWith(paramsStr, '}'))
return null;
paramsStr = paramsStr.substring(1, paramsStr.length() - 1);
String items[] = ListUtil.listToStringArray(paramsStr, ',');
Struct params=new StructImpl();
String arr$[] = items;
int index;
for(int i = 0; i < arr$.length; i++) {
String pair = arr$[i];
index = pair.indexOf('=');
if(index == -1) return null;
params.setEL(
KeyImpl.init(deleteQuotes(pair.substring(0, index).trim()).trim()),
deleteQuotes(pair.substring(index + 1).trim()));
}
return params;
}
示例2: getMemoryUsageCompact
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static Struct getMemoryUsageCompact(int type) {
java.util.List<MemoryPoolMXBean> manager = ManagementFactory.getMemoryPoolMXBeans();
Iterator<MemoryPoolMXBean> it = manager.iterator();
MemoryPoolMXBean bean;
MemoryUsage usage;
MemoryType _type;
Struct sct = new StructImpl();
while(it.hasNext()) {
bean = it.next();
usage = bean.getUsage();
_type = bean.getType();
if(type == MEMORY_TYPE_HEAP && _type != MemoryType.HEAP)
continue;
if(type == MEMORY_TYPE_NON_HEAP && _type != MemoryType.NON_HEAP)
continue;
double d = ((int)(100D / usage.getMax() * usage.getUsed())) / 100D;
sct.setEL(KeyImpl.init(bean.getName()), Caster.toDouble(d));
}
return sct;
}
示例3: getCustomInfo
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
@Override
public Struct getCustomInfo() {
Struct metadata = CFMLEngineFactory.getInstance().getCreationUtil().createStruct();
metadata.setEL("hits", hitCount());
return metadata;
}
示例4: getCustomInfo
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
@Override
public Struct getCustomInfo() {
Struct info=CFMLEngineFactory.getInstance().getCreationUtil().createStruct();
long value = hitCount();
if(value>=0)info.setEL("hit_count", new Double(value));
value = missCount();
if(value>=0)info.setEL("miss_count", new Double(value));
return info;
}
示例5: actionInfo
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
* list all files and directories inside a directory
* @throws PageException
*/
private void actionInfo() throws PageException {
if(variable==null)
throw new ApplicationException("attribute variable is not defined for tag file");
checkFile(false,false,false,false);
Struct sct =new StructImpl();
pageContext.setVariable(variable,sct);
// fill data to query
sct.setEL(KeyConstants._name,file.getName());
sct.setEL(KeyConstants._size,Long.valueOf(file.length()));
sct.setEL(KeyConstants._type,file.isDirectory()?"Dir":"File");
sct.setEL("dateLastModified",new DateTimeImpl(pageContext,file.lastModified(),false));
sct.setEL("attributes",getFileAttribute(file));
if(SystemUtil.isUnix())sct.setEL(KeyConstants._mode,new ModeObjectWrap(file));
try {
BufferedImage bi = ImageUtil.toBufferedImage(file, null);
if(bi!=null) {
Struct img =new StructImpl();
img.setEL(KeyConstants._width,new Double(bi.getWidth()));
img.setEL(KeyConstants._height,new Double(bi.getHeight()));
sct.setEL(KeyConstants._img,img);
}
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
示例6: toStruct
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
* @param hashTable a Hashtable to a Struct
* @return casted struct
*/
private static Struct toStruct(Hashtable hashTable) {
if(hashTable==null) return null;
Enumeration e = hashTable.keys();
Struct sct=CFMLEngineFactory.getInstance().getCreationUtil().createStruct();
while(e.hasMoreElements()) {
Object key=e.nextElement();
sct.setEL(key.toString(),hashTable.get(key));
}
return sct;
}
示例7: executeORM
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private Object executeORM(SQL sql, int returnType, Struct ormoptions) throws PageException {
ORMSession session=ORMUtil.getSession(pageContext);
if(ormoptions==null) ormoptions=new StructImpl();
String dsn = null;
if (ormoptions!=null) dsn = Caster.toString(ormoptions.get(KeyConstants._datasource,null),null);
if(StringUtil.isEmpty(dsn,true)) dsn=ORMUtil.getDefaultDataSource(pageContext).getName();
// params
SQLItem[] _items = sql.getItems();
Array params=new ArrayImpl();
for(int i=0;i<_items.length;i++){
params.appendEL(_items[i]);
}
// query options
if(maxrows!=-1 && !ormoptions.containsKey(MAX_RESULTS)) ormoptions.setEL(MAX_RESULTS, new Double(maxrows));
if(timeout!=null && ((int)timeout.getSeconds())>0 && !ormoptions.containsKey(TIMEOUT)) ormoptions.setEL(TIMEOUT, new Double(timeout.getSeconds()));
/* MUST
offset: Specifies the start index of the resultset from where it has to start the retrieval.
cacheable: Whether the result of this query is to be cached in the secondary cache. Default is false.
cachename: Name of the cache in secondary cache.
*/
Object res = session.executeQuery(pageContext,dsn,sql.getSQLString(),params,unique,ormoptions);
if(returnType==RETURN_TYPE_ARRAY_OF_ENTITY) return res;
return session.toQuery(pageContext, res, null);
}
示例8: getAllowedSQL
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
@Override
public Struct getAllowedSQL() {
Struct allow=new StructImpl();
allow.setEL(KeyConstants._alter, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_ALTER)));
allow.setEL(KeyConstants._create, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_CREATE)));
allow.setEL(KeyConstants._delete, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_DELETE)));
allow.setEL(KeyConstants._drop, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_DROP)));
allow.setEL(KeyConstants._grant, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_GRANT)));
allow.setEL(KeyConstants._insert, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_INSERT)));
allow.setEL(KeyConstants._revoke, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_REVOKE)));
allow.setEL(KeyConstants._select, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_SELECT)));
allow.setEL("storedproc", Caster.toBoolean(true));// TODO
allow.setEL(KeyConstants._update, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_UPDATE)));
return allow;
}
示例9: doGetGatewayEntry
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private void doGetGatewayEntry() throws PageException {
String id=getString("admin",action,"id");
Map entries = ((ConfigWebImpl)config).getGatewayEngine().getEntries();
Iterator it = entries.keySet().iterator();
GatewayEntry ge;
//Gateway g;
Struct sct;
while(it.hasNext()) {
String key=(String)it.next();
if(key.equalsIgnoreCase(id)) {
ge=(GatewayEntry) entries.get(key);
//g=ge.getGateway();
sct=new StructImpl();
sct.setEL("id",ge.getId());
sct.setEL("class",ge.getClassDefinition().getClassName());
sct.setEL("bundleName",ge.getClassDefinition().getName());
sct.setEL("bundleVersion",ge.getClassDefinition().getVersionAsString());
sct.setEL("listenerCfcPath", ge.getListenerCfcPath());
sct.setEL("cfcPath",ge.getCfcPath());
sct.setEL("startupMode",GatewayEntryImpl.toStartup(ge.getStartupMode(),"automatic"));
sct.setEL("custom",ge.getCustom());
sct.setEL("readOnly",Caster.toBoolean(ge.isReadOnly()));
sct.setEL("state",GatewayEngineImpl.toStringState(GatewayUtil.getState(ge), "failed"));
pageContext.setVariable(getString("admin",action,"returnVariable"),sct);
return;
}
}
throw new ApplicationException("there is no gateway entry with id ["+id+"]");
}
示例10: merge
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static Struct merge(Struct[] scts) {
Struct sct=new StructImpl();
for(int i=scts.length-1;i>=0;i--){
Iterator<Entry<Key, Object>> it = scts[i].entryIterator();
Entry<Key, Object> e;
while(it.hasNext()){
e = it.next();
sct.setEL(e.getKey(), e.getValue());
}
}
return sct;
}
示例11: toStruct
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private Struct toStruct(IndexResult result) {
Struct sct=new StructImpl();
sct.setEL("deleted",new Double(result.getCountDeleted()));
sct.setEL("inserted",new Double(result.getCountInserted()));
sct.setEL("updated",new Double(result.getCountUpdated()));
return sct;
}
示例12: setCFLogin
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
* @param username
* @param password
*/
private void setCFLogin(Object username, Object password) {
if(username==null) return;
if(password==null) password="";
Struct sct=new StructImpl();
sct.setEL(KeyConstants._name,username);
sct.setEL(KeyConstants._password,password);
pageContext.undefinedScope().setEL(CFLOGIN,sct);
}
示例13: next
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
@Override
public Object next() {
try {
if(qry.go(++current,pid)) {
Struct sct=new StructImpl();
for(int i=0;i<names.length;i++){
sct.setEL(names[i], qry.get(names[i],NullSupportHelper.empty()));
}
return sct;
}
} catch (PageException pe) {
throw new PageRuntimeException(pe);
}
return null;
}
示例14: getSummaryInfo
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public Struct getSummaryInfo() {
Struct infostruct = new StructImpl();
int sheets = workbook.getNumberOfSheets();
infostruct.setEL("SHEETS", new Double(sheets));
if(sheets>0) {
StringBuilder sb=new StringBuilder();
for(int i=0; i<sheets; i++){
if(i>0)sb.append(',');
sb.append(workbook.getSheetName(i));
}
infostruct.setEL("SHEETNAMES", sb.toString());
}
if(xmlFormat==FORMAT_HSSF) {
infostruct.setEL("SPREADSHEETTYPE", "Excel");
HSSFWorkbook hssfworkbook = (HSSFWorkbook)workbook;
info(infostruct,hssfworkbook.getSummaryInformation());
info(infostruct,hssfworkbook.getDocumentSummaryInformation());
}
else if(xmlFormat==FORMAT_XSSF) {
infostruct.put("SPREADSHEETTYPE", "Excel (2007)");
XSSFWorkbook xssfworkbook = (XSSFWorkbook)workbook;
POIXMLProperties props = xssfworkbook.getProperties();
info(infostruct,props.getCoreProperties().getUnderlyingProperties());
info(infostruct,props.getExtendedProperties().getUnderlyingProperties());
}
return infostruct;
}
示例15: setUnknownHost
import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private void setUnknownHost(Struct cfhttp,Throwable t) {
cfhttp.setEL(CHARSET,"");
cfhttp.setEL(ERROR_DETAIL,"Unknown host: "+t.getMessage());
cfhttp.setEL(FILE_CONTENT,"Connection Failure");
cfhttp.setEL(KeyConstants._header,"");
cfhttp.setEL(KeyConstants._mimetype,"Unable to determine MIME type of file.");
cfhttp.setEL(RESPONSEHEADER,new StructImpl());
cfhttp.setEL(STATUSCODE,"Connection Failure. Status code unavailable.");
cfhttp.setEL(KeyConstants._text,Boolean.TRUE);
}