java的typeinfo_Java TypeInfo.getTypeName方法代码示例

import org.w3c.dom.TypeInfo; //导入方法依赖的package包/类

/**

* Determine which Release could be used to represent the indicated

* Document at a specific target version. If the target version has

* multiple views then the message type is used to make the selection.

*

* @param documentThe source document being converted.

* @paramsourceThe Release object for the source document.

* @param targetVersionNumberThe target version number.

* @returnThe Release instance for the target schema.

* @sinceTFP 1.7

*/

public static Release compatibleRelease (Document document, Release source, String targetVersionNumber)

{

VersionsourceVersion = Version.parse (source.getVersion ());

VersiontargetVersion = Version.parse (targetVersionNumber);

String view = null;

Stringtype= null;

// If the target this not 5.0 or later its a direct conversion

if (targetVersion.getMajor () <= 4)

return (Releases.FPML.getReleaseForVersion (targetVersionNumber));

// Otherwise determine the target view based on version and message type

if (sourceVersion.getMajor () <= 3)

view = "confirmation";

else if (sourceVersion.getMajor () == 4) {

Element root = document.getDocumentElement ();

TypeInfo info = root.getSchemaTypeInfo ();

if ((info == null) || (info.getTypeName () == null)) {

NamedNodeMap list = root.getAttributes ();

for (int index = 0; index < list.getLength (); ++index) {

Attr attr = (Attr) list.item (index);

if ((attr.getNamespaceURI () != null)

&& attr.getNamespaceURI ().equals (Schema.INSTANCE_URL)

&& attr.getLocalName ().equals ("type")) {

type = attr.getValue ();

break;

}

}

}

else

type = info.getTypeName ();

// Look for messages that are in the reporting view

if (type.equals ("CancelTradeCashflows")

|| type.equals ("CreditEventNotification")

|| type.equals ("PositionAcknowledged")

|| type.equals ("PositionAsserted")

|| type.equals ("PositionMatchResults")

|| type.equals ("PositionReport")

|| type.equals ("RequestPortfolio")

|| type.equals ("RequestPositionReport")

|| type.equals ("RequestValuationReport")

|| type.equals ("TradeCashflowsAsserted")

|| type.equals ("TradeCashflowsMatchResult")

|| type.equals ("ValuationReport"))

view = "reporting";

else

view = "confirmation";

}

else

view = extractView (((SchemaRelease) source).getNamespaceUri ());

// Find a release that matches the target version and view

Enumeration cursor = Releases.FPML.releases ();

while (cursor.hasMoreElements ()) {

Release target = cursor.nextElement ();

if (target.getVersion ().equals (targetVersionNumber)) {

if (view.equals (extractView (((SchemaRelease) target).getNamespaceUri ())))

return (target);

}

}

// Otherwise no possible release

return (null);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值