本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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>> ---
}