当前位置: 首页>>代码示例>>Java>>正文


Java Struct.containsKey方法代码示例

本文整理汇总了Java中lucee.runtime.type.Struct.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java Struct.containsKey方法的具体用法?Java Struct.containsKey怎么用?Java Struct.containsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lucee.runtime.type.Struct的用法示例。


在下文中一共展示了Struct.containsKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPropeties

import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static void setPropeties(PageContext pc, Component cfc, Struct properties, boolean ignoreNotExisting) throws PageException { 
	if(properties==null) return;
	
	// argumentCollection
	if(properties.size()==1 && properties.containsKey(KeyConstants._argumentCollection) && !cfc.containsKey(KeyConstants._setArgumentCollection)) {
		properties=Caster.toStruct(properties.get(KeyConstants._argumentCollection));
	}
	
	Iterator<Entry<Key, Object>> it = properties.entryIterator();
	Entry<Key, Object> e;
	while(it.hasNext()){
		e = it.next();
		if(ignoreNotExisting) {
			try {
				cfc.call(pc, "set"+e.getKey().getString(), new Object[]{e.getValue()});
			}
			catch(Throwable t){
				ExceptionUtil.rethrowIfNecessary(t);
			}
		}
		else {
			cfc.call(pc, "set"+e.getKey().getString(), new Object[]{e.getValue()});
		}
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:26,代码来源:EntityNew.java

示例2: setPropeties

import lucee.runtime.type.Struct; //导入方法依赖的package包/类
public static void setPropeties(PageContext pc, Component c, Struct properties, boolean ignoreNotExisting) throws PageException { 
	if(properties==null) return;
	
	// argumentCollection
	if(properties.size()==1 && properties.containsKey(KeyConstants._argumentCollection) && !c.containsKey(KeyConstants._setArgumentCollection)) {
		properties=Caster.toStruct(properties.get(KeyConstants._argumentCollection));
	}
	
	Iterator<Entry<Key, Object>> it = properties.entryIterator();
	Entry<Key, Object> e;
	while(it.hasNext()){
		e = it.next();
		if(ignoreNotExisting) {
			try {
				c.call(pc, "set"+e.getKey().getString(), new Object[]{e.getValue()});
			}
			catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
		}
		else {
			c.call(pc, "set"+e.getKey().getString(), new Object[]{e.getValue()});
		}
	}
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:24,代码来源:EntityNew.java

示例3: 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);
		
	}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:29,代码来源:Query.java

示例4: copy

import lucee.runtime.type.Struct; //导入方法依赖的package包/类
/**
 * copy data from source struct to target struct
 * @param source 
 * @param target 
 * @param overwrite overwrite data if exist in target
 */
public static void copy(Struct source, Struct target, boolean overwrite) {
	Iterator<Entry<Key, Object>> it = source.entryIterator();
	Entry<Key, Object> e;
    while(it.hasNext()) {
    	e = it.next();
        if(overwrite || !target.containsKey(e.getKey())) 
            target.setEL(e.getKey(),e.getValue());
    }
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:16,代码来源:StructUtil.java

示例5: 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 || returnType==RETURN_TYPE_UNDEFINED) return res;
		return session.toQuery(pageContext, res, null);
		
	}
 
开发者ID:lucee,项目名称:Lucee,代码行数:30,代码来源:Query.java

示例6: set

import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static void set(final JpegImageMetadata jpegMetadata, final TagInfo tagInfo, Struct info) throws ImageReadException {
    final TiffField field = jpegMetadata.findEXIFValueWithExactMatch(tagInfo);
    if (field != null) {
        if(!info.containsKey(tagInfo.name)){
        	Object val = val(field.getValue());
        	if(val!=null)info.setEL(tagInfo.name, val);
        }
    }
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:10,代码来源:Metadata.java

示例7: toCFML

import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static Struct toCFML(DumpTable dt, Object object, RefBoolean hasReference, Struct colors) {
	
	Struct sct=new StructImpl();
	if(colors==null) {
		colors=new StructImpl();
		sct.setEL("colors", colors);
	}
	Collection.Key type;
	if(dt.getType()!=null) type=KeyImpl.init(dt.getType());
	else if(object!=null) type=KeyImpl.init(object.getClass().getName());
	else type=KeyConstants._null;
	
	// colors
	String borderColor = toShortColor(dt.getBorderColor());
	String fontColor = toShortColor(dt.getFontColor());
	String highLightColor = toShortColor(dt.getHighLightColor());
	String normalColor = toShortColor(dt.getNormalColor());
	// create color id
	Key colorId = KeyImpl.init(Long.toString(HashUtil.create64BitHash(new StringBuilder(borderColor)
	.append(':').append(fontColor)
	.append(':').append(highLightColor)
	.append(':').append(normalColor)),Character.MAX_RADIX));
	
	
	if(!colors.containsKey(colorId)) {
		Struct color=new StructImpl();
		StructUtil.setELIgnoreWhenNull(color,"borderColor", borderColor);
		StructUtil.setELIgnoreWhenNull(color,"fontColor", fontColor);
		StructUtil.setELIgnoreWhenNull(color,"highLightColor", highLightColor);
		StructUtil.setELIgnoreWhenNull(color,"normalColor", normalColor);
		colors.setEL(colorId, color);
	}
	

	/*StructUtil.setELIgnoreWhenNull(sct,"borderColor", borderColor);
	StructUtil.setELIgnoreWhenNull(sct,"fontColor", fontColor);
	StructUtil.setELIgnoreWhenNull(sct,"highLightColor", highLightColor);
	StructUtil.setELIgnoreWhenNull(sct,"normalColor", normalColor);
	*/
	StructUtil.setELIgnoreWhenNull(sct,"colorId", colorId.getString());
	StructUtil.setELIgnoreWhenNull(sct,KeyConstants._comment, dt.getComment());
	StructUtil.setELIgnoreWhenNull(sct,KeyConstants._height, dt.getHeight());
	StructUtil.setELIgnoreWhenNull(sct,KeyConstants._width, dt.getWidth());
	StructUtil.setELIgnoreWhenNull(sct,KeyConstants._title, dt.getTitle());
	
	sct.setEL(KeyConstants._type, type.getString());
	if(!StringUtil.isEmpty(dt.getId()))sct.setEL(KeyConstants._id, dt.getId());
		
	if("ref".equals(dt.getType())){
		hasReference.setValue(true);
		sct.setEL(KeyConstants._ref, dt.getRef());
	}
	
	
	DumpRow[] drs = dt.getRows();
	DumpRow dr;
	Query qry=null;
	DumpData[] items;
	for(int r=0;r<drs.length;r++){
		dr=drs[r];
		items = dr.getItems();
		if(qry==null)qry=new QueryImpl(toColumns(items),drs.length,"data");
		for(int c=1;c<=items.length;c++){
			qry.setAtEL("data"+c, r+1, toCFML(items[c-1],object,hasReference,colors));
		}
		qry.setAtEL("highlight", r+1, new Double(dr.getHighlightType()));
		
	}
	if(qry!=null)sct.setEL(KeyConstants._data, qry);
	return sct;
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:72,代码来源:DumpStruct.java

示例8: createXMLMappingGenerator

import lucee.runtime.type.Struct; //导入方法依赖的package包/类
private static String createXMLMappingGenerator(Element id,Component cfc,Property prop,StringBuilder foreignCFC, SessionFactoryData data) throws PageException {
	Struct meta = prop.getDynamicAttributes();
	
	// generator
	String className=toString(cfc,prop,meta,"generator",data);
	if(Util.isEmpty(className,true)) return null;
	

	Document doc = CommonUtil.getDocument(id);
	Element generator = doc.createElement("generator");
	id.appendChild(generator);
	
	generator.setAttribute("class", className);
	
	//print.e("generator:"+className);
	
	// params
	Object obj=meta.get(PARAMS,null);
	//if(obj!=null){
		Struct sct=null;
		if(obj==null) obj=CommonUtil.createStruct();
		else if(obj instanceof String) obj=ORMUtil.convertToSimpleMap((String)obj);
		
		if(CommonUtil.isStruct(obj)) sct=CommonUtil.toStruct(obj);
		else throw ExceptionUtil.createException(data,cfc,"invalid value for attribute [params] of tag [property]",null);
		className=className.trim().toLowerCase();
		
		// special classes
		if("foreign".equals(className)){
			if(!sct.containsKey(PROPERTY)) sct.setEL(PROPERTY, toString(cfc,prop,meta, PROPERTY,true,data));
			
			if(sct.containsKey(PROPERTY)){
				String p = CommonUtil.toString(sct.get(PROPERTY),null);
				if(!Util.isEmpty(p))foreignCFC.append(p);
			}
			
			
		}
		else if("select".equals(className)){
			//print.e("select:"+toString(meta, "selectKey",true));
			if(!sct.containsKey(KEY)) sct.setEL(KEY, toString(cfc,prop,meta, "selectKey",true,data));
		}
		else if("sequence".equals(className)){
			if(!sct.containsKey(SEQUENCE)) sct.setEL(SEQUENCE, toString(cfc,prop,meta, "sequence",true,data));
		}
		
		//Key[] keys = sct.keys();
		Iterator<Entry<Key, Object>> it = sct.entryIterator();
		Entry<Key, Object> e;
		Element param;
		while(it.hasNext()){
			e = it.next();
			param = doc.createElement("param");
			generator.appendChild(param);
			
			param.setAttribute( "name", e.getKey().getLowerString());
			param.appendChild(doc.createTextNode(CommonUtil.toString(e.getValue())));
			
		}
	//}
	return className;
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:63,代码来源:HBMCreator.java


注:本文中的lucee.runtime.type.Struct.containsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。