Skip to main content
summaryrefslogtreecommitdiffstats
blob: fe4a2e38ee9a706289e5f376371345b3d517aa5a (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
85
86
87
88
89
90
91
92
93
94
/*******************************************************************************
 * Copyright (c) 2000, 2005 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.javamofvisitoractions;

import java.util.Vector;

import org.eclipse.jem.java.JavaClass;
import org.eclipse.jst.ws.internal.consumption.codegen.Visitor;
import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction;
import org.eclipse.osgi.util.NLS;





/**
* Objects of this class represent a VisitorAction.
* It will automatically walk the methods in the JavaClass
* */
public abstract class VisitorActionImpl implements VisitorAction 
{

  private Vector beansVisited = null;
  private Vector messages = null;

  public VisitorActionImpl( Vector messages, Vector beansVisited)
  	{
  	 this.messages = messages;
  	 this.beansVisited = beansVisited;
  	}
  
  public void initialize(String resident)
  {
    //nothing to be done but must be implemented
  }

 /**
  * Returns the vector of all messages found
  */
  public Vector getMessages ()
  {
  	if (messages == null) 
  		messages = new Vector();
    return messages;
  }

  public Vector getBeansVisited()
  	{
		if ( beansVisited == null)
  			beansVisited = new Vector(); 
        return beansVisited;
   }

  public void addVisitedBean( JavaClass bean)
  	{
  		if ( beansVisited == null)
  			beansVisited = new Vector();
  		beansVisited.add(bean);
  	}

  public boolean isBeanVisited (JavaClass bean)
  	{
  		return (beansVisited != null && beansVisited.contains(bean));
  	}

  /**
  * sets the visitor that calls the visit
  * @parameter Visitor
  */

  public void setVisitor(Visitor visitor)
  {
  }

  protected void addMessage ( String key )
  {
    getMessages().add(key);
  }

  protected void addMessage ( String key, Object[] args )
  {
    getMessages().add(NLS.bind(key,args));
  }

}

Back to the top