Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3e37c717a89ddd2dd6cca2b4ddee7d0b3aab3532 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors;

import java.util.Iterator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jem.java.JavaClass;
import org.eclipse.jem.java.Method;
import org.eclipse.jst.ws.internal.consumption.codegen.Visitor;
import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction;
import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection;


/**
* Objects of this class represent a visitor.
* */
public class JavaMofMethodVisitor implements Visitor 
{

  // Copyright
  public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
  public String SET_ENDPOINT = "setEndPoint";
  public String GET_ENDPOINT = "getEndPoint";
  private BooleanSelection[] fMethodsSelected;


  /*
  * Constructor
  **/
  public JavaMofMethodVisitor()
  {
  }
 
  public String UNDER_SCORE = "_";

  /*
  * Run through all the methods in this bean
  * @param JavaClass javaclass that holds the methods
  * @param VisitorAction Action to be performed on each method
  **/
  public IStatus run ( Object javaclass, VisitorAction vAction)
  {
  	IStatus status = Status.OK_STATUS;
    JavaClass javaClass = (JavaClass)javaclass;
    for (Iterator m=javaClass.getPublicMethods().iterator(); m.hasNext(); ) {
      Method method=(Method)m.next();
      if(fMethodsSelected != null)  {
        boolean methodSelected = false;
      	for(int i =0;i < fMethodsSelected.length;i++){
          if(fMethodsSelected[i] == null) continue;
          if ( fMethodsSelected[i].getValue().equals(method.getMethodElementSignature()))
            methodSelected = (boolean) fMethodsSelected[i].isSelected();
        }
        
        method.getName();
        
        if(methodSelected)
          status = vAction.visit(method);  
        
      }
      else {
        status = vAction.visit(method);   
      }

    }
    return status;
  }

  public void setMethodSelection(BooleanSelection[] methodSelected)
  {
    fMethodsSelected = methodSelected;
  }
  
}

Back to the top