org.apache.xmlbeans.impl.jam.visitor.TraversingMVisitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.xmlbeans
Show all versions of org.apache.servicemix.bundles.xmlbeans
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
/* Copyright 2004 The Apache Software Foundation
*
* Licensed 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.xmlbeans.impl.jam.visitor;
import org.apache.xmlbeans.impl.jam.mutable.MAnnotatedElement;
import org.apache.xmlbeans.impl.jam.mutable.MAnnotation;
import org.apache.xmlbeans.impl.jam.mutable.MClass;
import org.apache.xmlbeans.impl.jam.mutable.MComment;
import org.apache.xmlbeans.impl.jam.mutable.MConstructor;
import org.apache.xmlbeans.impl.jam.mutable.MField;
import org.apache.xmlbeans.impl.jam.mutable.MInvokable;
import org.apache.xmlbeans.impl.jam.mutable.MMethod;
import org.apache.xmlbeans.impl.jam.mutable.MPackage;
import org.apache.xmlbeans.impl.jam.mutable.MParameter;
/**
* An adaptor which helps another MVisitor visit a JElement and its
* children, recursively. Note that inherited class or annotations members
* are never visited, nor are referenced classes (e.g. referenced via member
* types). The following table lists each element and the child types
* which are traversed.
*
*
* Element Sub-elements traversal
* Package Classes, Annotations, Comments
* Class Fields, Constructors, Methods, Annotations, Comments
* Field Annotations, Comments
* Constructor Parameters, Annotations, Comments
* Method Parameters, Annotations, Comments
* Parameter Annotations, Comments
* Annotation [none]
* Comment [none]
*
*
*
* @author Patrick Calahan <email: pcal-at-bea-dot-com>
*/
public class TraversingMVisitor extends MVisitor {
// ========================================================================
// Variables
private MVisitor mDelegate;
// ========================================================================
// Constructors
public TraversingMVisitor(MVisitor jv) {
if (jv == null) throw new IllegalArgumentException("null jv");
mDelegate = jv;
}
// ========================================================================
// JVisitor implementation
public void visit(MPackage pkg) {
pkg.accept(mDelegate);
MClass[] c = pkg.getMutableClasses();
for(int i=0; i