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


Java IDataUtil.getIData方法代码示例

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


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

示例1: getDocumentContents

import com.wm.data.IDataUtil; //导入方法依赖的package包/类
private IData getDocumentContents() throws Exception {
	IData idreturn;
	IData idata = idataFromClasspathResource(idataFile);
	IDataCursor idc = idata.getCursor();
	if (IDataUtil.size(idc) == 1) {
		IData id = IDataUtil.getIData(idc, documentName);
		if (id != null) {
			idreturn = id;
		} else {
			idreturn = idata;
		}
	} else {
		idreturn = idata;
	}
	idc.destroy();
	return idreturn;
}
 
开发者ID:wmaop,项目名称:wm-jbehave,代码行数:18,代码来源:DocumentMatchStep.java

示例2: emit

import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
 * Returns a MIME type string comprised of the components specified in the given IData document.
 *
 * @param document The IData document to be converted to a MIME type string.
 * @return A MIME type string representing the components specified in the given IData document.
 * @throws MimeTypeParseException If the given MIME type string is malformed.
 */
public static String emit(IData document) throws MimeTypeParseException {
    if (document == null) return null;

    IDataCursor cursor = document.getCursor();
    String type = IDataUtil.getString(cursor, "type");
    String subtype = IDataUtil.getString(cursor, "subtype");
    IData parameters = IDataUtil.getIData(cursor, "parameters");
    cursor.destroy();

    if (type == null) throw new IllegalArgumentException("type must not be null");
    if (subtype == null) throw new IllegalArgumentException("subtype must not be null");

    MimeType mimeType = new MimeType(type, subtype);

    if (parameters != null) {
        parameters = IDataHelper.sort(parameters, false, true);
        cursor = parameters.getCursor();
        while (cursor.next()) {
            String key = cursor.getKey();
            Object value = cursor.getValue();
            if (value instanceof String) {
                mimeType.setParameter(key, (String)value);
            }
        }
        cursor.destroy();
    }

    return mimeType.toString();
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:37,代码来源:MIMETypeHelper.java

示例3: testParse

import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Test
public void testParse() throws Exception {
    IData document = MIMETypeHelper.parse("text/plain;charset=UTF-8;foo=bar");
    IDataCursor cursor = document.getCursor();
    assertEquals("text", IDataUtil.getString(cursor, "type"));
    assertEquals("plain", IDataUtil.getString(cursor, "subtype"));
    IData parameters = IDataUtil.getIData(cursor, "parameters");
    cursor.destroy();

    cursor = parameters.getCursor();
    assertEquals("UTF-8", IDataUtil.getString(cursor, "charset"));
    assertEquals("bar", IDataUtil.getString(cursor, "foo"));
    cursor.destroy();
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:15,代码来源:MIMETypeHelperTest.java

示例4: submit

import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public static final void submit (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(submit)>> ---
	// @sigtype java 3.5
	// [i] record:1:required services
	// [i] - field:0:required serviceName
	// [i] - record:0:optional input
	// [i] - field:0:optional priority {"1","2","3","4","5","6","7","8","9","10"}
	// [i] field:0:required pool
	// [i] field:0:optional deepClone {"true","false"}
	// [o] object:1:required futures
	IDataCursor pipelineCur = pipeline.getCursor();
	
	try {
		IData[] services = IDataUtil.getIDataArray(pipelineCur, "services");
		
		if(services == null || services.length == 0) {
			return;
		}
		
		String pool = IDataUtil.getString(pipelineCur, "pool");
	
		boolean deepClone = Boolean.valueOf(IDataUtil.getString(pipelineCur, "deepClone"));
					
		IDataCursor servicesCur = null;
		
		List<Future> futures = new ArrayList<Future>();
		
		for(int i=0; i<services.length; i++) {
			servicesCur = services[i].getCursor();
			
			String serviceName = IDataUtil.getString(servicesCur, "serviceName");
			IData input = IDataUtil.getIData(servicesCur, "input");
			String sPriority = IDataUtil.getString(servicesCur, "priority");
			
			if(deepClone) {
				futures.add(ReactiveWMFacade.submit(pool, serviceName, getPriority(sPriority), IDataUtil.deepClone(input)));	
			} else {
				futures.add(ReactiveWMFacade.submit(pool, serviceName, getPriority(sPriority), input));
			}
			
		}
		
		if(futures == null || futures.size() != 0) {
			IDataUtil.put(pipelineCur, "futures", futures.toArray(new Future[futures.size()]));
		}
		
		if(servicesCur != null) {
			servicesCur.destroy();
		}
	} catch(Exception e) {
		throw new ServiceException(e);
	} finally {
		if(pipelineCur != null) {
			pipelineCur.destroy();
		}
	}
		
	// --- <<IS-END>> ---

               
}
 
开发者ID:teivah,项目名称:reactiveWM,代码行数:64,代码来源:pub.java


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