本文整理汇总了Java中org.eclipse.milo.opcua.stack.core.types.builtin.Variant类的典型用法代码示例。如果您正苦于以下问题:Java Variant类的具体用法?Java Variant怎么用?Java Variant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Variant类属于org.eclipse.milo.opcua.stack.core.types.builtin包,在下文中一共展示了Variant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseValue
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
public static DataValue parseValue(Object value, Marshaller marshaller) {
JAXBElement<?> jaxbElement = JAXBElement.class.cast(value);
StringWriter sw = new StringWriter();
try {
marshaller.marshal(jaxbElement, sw);
} catch (JAXBException e) {
LOGGER.warn("unable to marshal JAXB element: " + jaxbElement, e);
return new DataValue(Variant.NULL_VALUE);
}
String xmlString = sw.toString();
try {
XmlDecoder xmlDecoder = new XmlDecoder(new StringReader(xmlString));
Object valueObject = xmlDecoder.decodeVariantValue();
return new DataValue(new Variant(valueObject));
} catch (Throwable t) {
LOGGER.warn("unable to parse Value: " + xmlString, t);
return new DataValue(Variant.NULL_VALUE);
}
}
示例2: getPrimitiveArrayVariants
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
@DataProvider(name = "PrimitiveArrayVariantProvider")
public Object[][] getPrimitiveArrayVariants() {
return new Object[][]{
{new Variant(new int[]{0, 1, 2, 3}),
new Variant(new Integer[]{0, 1, 2, 3})},
{new Variant(new int[][]{{0, 1}, {2, 3}}),
new Variant(new Integer[][]{{0, 1}, {2, 3}})},
{new Variant(new long[]{0L, 1L, 2L, 3L}),
new Variant(new Long[]{0L, 1L, 2L, 3L})},
{new Variant(new long[][]{{0L, 1L}, {2L, 3L}}),
new Variant(new Long[][]{{0L, 1L}, {2L, 3L}})}
};
}
示例3: toString
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
public static String toString(final Variant value) {
return String.format("%s : %s",
value.getDataType() // get data type
.map(id -> NodeIds.lookup(id).orElse(id.toParseableString())) // map to ID or use node id
.orElse("<unknown>"), // default to "unknown"
value.getValue());
}
示例4: write
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
public static CompletableFuture<StatusCode> write(
final OpcUaClient client,
final NodeId nodeId,
final Object value) {
return client.writeValue(nodeId, new DataValue(new Variant(value)));
}
示例5: buildNode189
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode189()
throws Exception {
UaVariableNode node = new BaseDataVariableNode(this.nodeMap, NodeId.parse("ns=0;i=12844"), new QualifiedName(0, "SetPublishingModeCount"), new LocalizedText("en", "SetPublishingModeCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=871"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=12844"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12816"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=12844"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=63"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12844"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12844"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12816"), NodeClass.Variable, false));
this.nodeMap.addNode(node);
}
示例6: buildNode234
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode234()
throws Exception {
UaVariableNode node = new DataTypeDescriptionNode(this.nodeMap, NodeId.parse("ns=0;i=8855"), new QualifiedName(0, "SessionDiagnosticsDataType"), new LocalizedText("en", "SessionDiagnosticsDataType"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=12"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=8855"), NodeId.parse("ns=0;i=39"), ExpandedNodeId.parse("svr=0;i=866"), NodeClass.Object, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=8855"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=8252"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=8855"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=69"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=8855"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=8252"), NodeClass.Variable, false));
String valueXml;
OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(new StringReader(new String("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns2:String xmlns=\"http://opcfoundation.org/BinarySchema/\" xmlns:ns2=\"http://opcfoundation.org/UA/2008/02/Types.xsd\" xmlns:ns3=\"http://opcfoundation.org/UA/2011/03/UANodeSet.xsd\">//xs:element[@name='SessionDiagnosticsDataType']</ns2:String>")));
Object valueObject = decoder.readVariantValue();
DataValue value = new DataValue(new Variant(valueObject));
node.setValue(value);
this.nodeMap.addNode(node);
}
示例7: buildNode397
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode397()
throws Exception {
UaVariableNode node = new PropertyNode(this.nodeMap, NodeId.parse("ns=0;i=13836"), new QualifiedName(0, "LastUpdateTime"), new LocalizedText("en", "LastUpdateTime"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=294"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=13836"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=13815"), NodeClass.Object, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=13836"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=68"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=13836"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=13836"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=13815"), NodeClass.Object, false));
this.nodeMap.addNode(node);
}
示例8: buildNode358
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode358()
throws Exception {
UaVariableNode node = new FiniteStateVariableNode(this.nodeMap, NodeId.parse("ns=0;i=9456"), new QualifiedName(0, "CurrentState"), new LocalizedText("en", "CurrentState"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=21"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=9456"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=9455"), NodeClass.Object, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=9456"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=9457"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=9456"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=2760"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=9456"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=9456"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=9455"), NodeClass.Object, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=9456"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=9457"), NodeClass.Variable, true));
this.nodeMap.addNode(node);
}
示例9: buildNode249
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode249()
throws Exception {
UaVariableNode node = new BaseDataVariableNode(this.nodeMap, NodeId.parse("ns=0;i=8893"), new QualifiedName(0, "DiscardedMessageCount"), new LocalizedText("en", "DiscardedMessageCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=7"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=8893"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2172"), NodeClass.VariableType, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=8893"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=63"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=8893"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=8893"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2172"), NodeClass.VariableType, false));
this.nodeMap.addNode(node);
}
示例10: buildNode744
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode744()
throws Exception {
UaVariableNode node = new PropertyNode(this.nodeMap, NodeId.parse("ns=0;i=2395"), new QualifiedName(0, "RecycleCount"), new LocalizedText("en", "RecycleCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=6"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=2395"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=2391"), NodeClass.ObjectType, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=2395"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=68"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2395"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2395"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=2391"), NodeClass.ObjectType, false));
this.nodeMap.addNode(node);
}
示例11: setQuality
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
@Override
public synchronized void setQuality(StatusCode quality) {
if (lastValue == null) {
setValue(new DataValue(Variant.NULL_VALUE, quality, DateTime.now(), DateTime.now()));
} else {
DataValue value = new DataValue(
lastValue.getValue(),
quality,
DateTime.now(),
DateTime.now());
setValue(value);
}
}
示例12: buildNode175
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode175()
throws Exception {
UaVariableNode node = new BaseDataVariableNode(this.nodeMap, NodeId.parse("ns=0;i=12830"), new QualifiedName(0, "TotalRequestCount"), new LocalizedText("en", "TotalRequestCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=871"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=12830"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12816"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=12830"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=63"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12830"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12830"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12816"), NodeClass.Variable, false));
this.nodeMap.addNode(node);
}
示例13: buildNode1247
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode1247()
throws Exception {
UaVariableNode node = new BaseDataVariableNode(this.nodeMap, NodeId.parse("ns=0;i=12136"), new QualifiedName(0, "BrowseNextCount"), new LocalizedText("en", "BrowseNextCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=871"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=12136"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12098"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=12136"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=63"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12136"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12136"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12098"), NodeClass.Variable, false));
this.nodeMap.addNode(node);
}
示例14: buildNode593
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode593()
throws Exception {
UaVariableNode node = new BaseDataVariableNode(this.nodeMap, NodeId.parse("ns=0;i=2140"), new QualifiedName(0, "CurrentTime"), new LocalizedText("en", "CurrentTime"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=294"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=2140"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2138"), NodeClass.VariableType, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=2140"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=63"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2140"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2140"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2138"), NodeClass.VariableType, false));
this.nodeMap.addNode(node);
}
示例15: buildNode200
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; //导入依赖的package包/类
private void buildNode200()
throws Exception {
UaVariableNode node = new BaseDataVariableNode(this.nodeMap, NodeId.parse("ns=0;i=12855"), new QualifiedName(0, "TranslateBrowsePathsToNodeIdsCount"), new LocalizedText("en", "TranslateBrowsePathsToNodeIdsCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=871"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=12855"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12816"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=12855"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=63"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12855"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=12855"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=12816"), NodeClass.Variable, false));
this.nodeMap.addNode(node);
}