All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.commons.configuration2.tree.NodeHandlerDecorator Maven / Gradle / Ivy

Go to download

Tools to assist in the reading of configuration/preferences files in various formats

There is a newer version: 2.10.1
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.configuration2.tree;

import java.util.List;
import java.util.Set;

/**
 * 

* An abstract base class for decorators of a {@code NodeHandler}. *

*

* This class implements all methods of the {@code NodeHandler} interface by * delegating to another instance. This is convenient if specific functionality * of a {@code NodeHandler} is to be adapted for a special use case. Concrete * sub classes have to implement the {@code getDecoratedNodeHandler()} method to * provide the underlying handler. *

* * @version $Id: NodeHandlerDecorator.java 1636036 2014-11-01 20:49:13Z oheger $ * @since 2.0 * @param the type of the nodes supported by this handler */ public abstract class NodeHandlerDecorator implements NodeHandler { @Override public String nodeName(T node) { return getDecoratedNodeHandler().nodeName(node); } @Override public Object getValue(T node) { return getDecoratedNodeHandler().getValue(node); } @Override public T getParent(T node) { return getDecoratedNodeHandler().getParent(node); } @Override public List getChildren(T node) { return getDecoratedNodeHandler().getChildren(node); } @Override public List getMatchingChildren(T node, NodeMatcher matcher, C criterion) { return getDecoratedNodeHandler().getMatchingChildren(node, matcher, criterion); } @Override public int getMatchingChildrenCount(T node, NodeMatcher matcher, C criterion) { return getDecoratedNodeHandler().getMatchingChildrenCount(node, matcher, criterion); } @Override public List getChildren(T node, String name) { return getDecoratedNodeHandler().getChildren(node, name); } @Override public T getChild(T node, int index) { return getDecoratedNodeHandler().getChild(node, index); } @Override public int indexOfChild(T parent, T child) { return getDecoratedNodeHandler().indexOfChild(parent, child); } @Override public int getChildrenCount(T node, String name) { return getDecoratedNodeHandler().getChildrenCount(node, name); } @Override public Set getAttributes(T node) { return getDecoratedNodeHandler().getAttributes(node); } @Override public boolean hasAttributes(T node) { return getDecoratedNodeHandler().hasAttributes(node); } @Override public Object getAttributeValue(T node, String name) { return getDecoratedNodeHandler().getAttributeValue(node, name); } @Override public boolean isDefined(T node) { return getDecoratedNodeHandler().isDefined(node); } @Override public T getRootNode() { return getDecoratedNodeHandler().getRootNode(); } /** * Returns the {@code NodeHandler} object that is decorated by this * instance. All method calls are delegated to this object. * * @return the decorated {@code NodeHandler} */ protected abstract NodeHandler getDecoratedNodeHandler(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy