alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.java.ui.nodes;

import org.openide.src.*;
import org.openide.nodes.Node;
import org.netbeans.jmi.javamodel.*;

/**
 * Bridges {@link SourceNodeFactory} to {@link org.openide.src.nodes.ElementNodeFactory}
 */
final class BridgeSource2Element implements ExElementNodeFactory {
    
    private final SourceNodeFactory delegate;
    
    public BridgeSource2Element(SourceNodeFactory delegate) {
        this.delegate = delegate;
    }

    public Node createConstructorNode(ConstructorElement element) {
        Constructor constr = (Constructor) BridgeUtils.getJavaObject(element);
        return delegate.createConstructorNode(constr);
    }

    public Node createMethodNode(MethodElement element) {
        Method method = (Method) BridgeUtils.getJavaObject(element);
        return delegate.createMethodNode(method);
    }

    public Node createFieldNode(FieldElement element) {
        Field field = (Field) BridgeUtils.getJavaObject(element);
        return delegate.createFieldNode(field);
    }

    public Node createInitializerNode(InitializerElement element) {
        Initializer init = (Initializer) BridgeUtils.getJavaObject(element);
        return delegate.createInitializerNode(init);
    }

    public Node createClassNode(ClassElement element) {
        JavaClass jo = null;
        if (element != null) {
            jo = (JavaClass) BridgeUtils.getJavaObject(element);
        }
        return delegate.createClassNode(jo);
    }

    public Node createWaitNode() {
        return delegate.createWaitNode();
    }

    public Node createErrorNode() {
        return delegate.createErrorNode();
    }

    public Node createEnumNode(JavaEnum element) {
        return delegate.createEnumNode(element);
    }

    public Node createEnumConstantNode(EnumConstant element) {
        return delegate.createEnumConstantNode(element);
    }

    public Node createAnnotationTypeNode(AnnotationType element) {
        return delegate.createAnnotationTypeNode(element);
    }

    public Node createAnnotationTypeMethodNode(Attribute element) {
        return delegate.createAnnotationTypeMethodNode(element);
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.