AttributeDelegateChain { @SafeVarargs public static AttributeDelegate create( AttributeDelegate root, Function<AttributeDelegate, AttributeDelegate>... childFns) { AttributeDelegate delegate = root; for (Function<AttributeDelegate, AttributeDelegate> childFn : childFns) { delegate = childFn.apply(delegate); } return delegate; }  @SafeVarargs static AttributeDelegate create(
        AttributeDelegate root,
        Function<AttributeDelegate, AttributeDelegate>... childFns);  }
@Test public void testCreate() throws Exception { List<String> list = new ArrayList<>(); AttributeDelegate delegate = AttributeDelegateChain.create( new AttributeDelegate() { @Override public DataValue getValue(AttributeContext context, VariableNode node) throws UaException { list.add("root"); return node.getValue(); } }, parent -> new DelegatingAttributeDelegate(parent) { @Override public DataValue getValue(AttributeContext context, VariableNode node) throws UaException { list.add("child1"); return super.getValue(context, node); } }, parent -> new DelegatingAttributeDelegate(parent) { @Override public DataValue getValue(AttributeContext context, VariableNode node) throws UaException { list.add("child2"); return super.getValue(context, node); } }, parent -> new DelegatingAttributeDelegate(parent) { @Override public DataValue getValue(AttributeContext context, VariableNode node) throws UaException { list.add("child3"); return super.getValue(context, node); } } ); UaNodeManager nodeManager = new UaNodeManager(); UaNodeContext context = new UaNodeContext() { @Override public OpcUaServer getServer() { return null; } @Override public NodeManager<UaNode> getNodeManager() { return nodeManager; } @Override public NamespaceTable getNamespaceTable() { return new NamespaceTable(); } }; UaVariableNode node = new UaVariableNode.UaVariableNodeBuilder(context) .setNodeId(NodeId.NULL_VALUE) .setAccessLevel(AccessLevel.READ_WRITE) .setBrowseName(QualifiedName.NULL_VALUE) .setDisplayName(LocalizedText.NULL_VALUE) .setDataType(Identifiers.String) .setTypeDefinition(Identifiers.BaseDataVariableType) .build(); node.setValue(new DataValue(new Variant("foo"))); DataValue value = delegate.getValue(new AttributeContext(null, null), node); assertEquals(value.getValue().getValue(), "foo"); assertEquals(list.get(0), "child3"); assertEquals(list.get(1), "child2"); assertEquals(list.get(2), "child1"); assertEquals(list.get(3), "root"); }