本文整理汇总了Java中org.eclipse.milo.opcua.sdk.server.util.AnnotationBasedInvocationHandler类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationBasedInvocationHandler类的具体用法?Java AnnotationBasedInvocationHandler怎么用?Java AnnotationBasedInvocationHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationBasedInvocationHandler类属于org.eclipse.milo.opcua.sdk.server.util包,在下文中一共展示了AnnotationBasedInvocationHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCallMeNode
import org.eclipse.milo.opcua.sdk.server.util.AnnotationBasedInvocationHandler; //导入依赖的package包/类
public static UaMethodNode createCallMeNode(final UShort index, final ServerNodeMap nodeMap) {
final UaMethodNode method = new UaMethodNode(
nodeMap,
new NodeId(index, "call-me-al"),
new QualifiedName(index, "Al"),
LocalizedText.english("Al"),
LocalizedText.english("Call me Al"),
UInteger.MIN, UInteger.MIN, true, true);
try {
final AnnotationBasedInvocationHandler handler = AnnotationBasedInvocationHandler
.fromAnnotatedObject(nodeMap, new CallMe());
method.setInputArguments(handler.getInputArguments());
method.setOutputArguments(handler.getOutputArguments());
method.setInvocationHandler(handler);
} catch (final Exception e) {
e.printStackTrace();
}
return method;
}
示例2: addMethodNode
import org.eclipse.milo.opcua.sdk.server.util.AnnotationBasedInvocationHandler; //导入依赖的package包/类
private void addMethodNode(UaFolderNode folderNode) {
UaMethodNode methodNode = UaMethodNode.builder(server.getNodeMap())
.setNodeId(new NodeId(namespaceIndex, "HelloWorld/sqrt(x)"))
.setBrowseName(new QualifiedName(namespaceIndex, "sqrt(x)"))
.setDisplayName(new LocalizedText(null, "sqrt(x)"))
.setDescription(
LocalizedText.english("Returns the correctly rounded positive square root of a double value."))
.build();
try {
AnnotationBasedInvocationHandler invocationHandler =
AnnotationBasedInvocationHandler.fromAnnotatedObject(
server.getNodeMap(), new SqrtMethod());
methodNode.setProperty(UaMethodNode.InputArguments, invocationHandler.getInputArguments());
methodNode.setProperty(UaMethodNode.OutputArguments, invocationHandler.getOutputArguments());
methodNode.setInvocationHandler(invocationHandler);
server.getNodeMap().addNode(methodNode);
folderNode.addReference(new Reference(
folderNode.getNodeId(),
Identifiers.HasComponent,
methodNode.getNodeId().expanded(),
methodNode.getNodeClass(),
true
));
methodNode.addReference(new Reference(
methodNode.getNodeId(),
Identifiers.HasComponent,
folderNode.getNodeId().expanded(),
folderNode.getNodeClass(),
false
));
} catch (Exception e) {
logger.error("Error creating sqrt() method.", e);
}
}