home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
ActionDescriptor.java
< prev
next >
Wrap
Text File
|
1998-10-19
|
7KB
|
196 lines
package com.symantec.itools.vcafe.beans;
// 07/01/97 CAR Created
/**
* A simple class that encapsulates a bean's Visual CafΘ "action" information as used
* by the Interaction Wizard. A Visual CafΘ action implies a relationship between
* objects (or between an object and itself) involving either event notification or data
* transmission. The Interaction Wizard allows users to graphically build these relationships
* between objects and then Visual CafΘ is able to generate the code for the specified
* relationship based on the underlying action information encapsulated in the
* ActionDescriptor.
*
* @version 1.0, July 1, 1997
*
* @author Symantec
*/
public class ActionDescriptor
extends java.beans.FeatureDescriptor
{
/**
* A constant indicating an input action.
* @see #setForm
*/
public static final String INPUT = "input";
/**
* A constant indicating an output action.
* @see #setForm
*/
public static final String OUTPUT = "output";
/**
* Constructs a default ActionDescriptor. Form, type, init, and expr
* are all empty strings.
* @see #setForm
* @see #setType
* @see #setInit
* @see #setExpr
*/
public ActionDescriptor() {
form = "";
type = "";
init = "";
expr = "";
}
/**
* Constructs a ActionDescriptor with the given form.
* Type, init, and expr are all empty strings.
* @param f the form string
* @see #setType
* @see #setInit
* @see #setExpr
*/
public ActionDescriptor(String f) {
if (f != INPUT && f != OUTPUT)
throw new IllegalArgumentException("acceptable values are \"input\" or \"output\"");
form = f;
type = "";
init = "";
expr = "";
}
/**
* Constructs a ActionDescriptor with the given form, type, and
* expr String values.
* @param f the form string
* @param t the type string
* @param e the expression string
* @param d a short description
*/
public ActionDescriptor(String f, String t, String e, String d) {
if (f != INPUT && f != OUTPUT)
throw new IllegalArgumentException("acceptable values are \"input\" or \"output\"");
form = f;
type = t;
init = "";
expr = e;
if (expr != null && expr.startsWith(".import"))
System.err.println("**Warning: Import specifications are not supported in action descriptors");
setShortDescription(d);
}
/**
* Constructs a ActionDescriptor with the given form, type, init, and
* expr String values.
* @param f the form string
* @param t the type string
* @param i the init string
* @param e the expression string
* @param d a short description
* @deprecated
*/
public ActionDescriptor(String f, String t, String i, String e, String d) {
if (f != INPUT && f != OUTPUT)
throw new IllegalArgumentException("acceptable values are \"input\" or \"output\"");
form = f;
type = t;
init = i;
if (init != null && !init.equals("")) {
System.err.println("**Warning: Non-blank initialization strings are not supported in action descriptors");
throw new IllegalArgumentException("initialization string is not supported");
}
expr = e;
if (expr != null && expr.startsWith(".import"))
System.err.println("**Warning: Import specifications are not supported in action descriptors");
setShortDescription(d);
}
/**
* Gets the current form string.
* @return the current form
* @see #setForm
*/
public String getForm() { return form; }
/**
* Sets the form string. The form of a action is either INPUT or OUTPUT. An output
* action defines an interaction that returns data; an input action defines an
* interaction that sets data, or initiates execution of a method that doesn't take data.
* @return the new form
* @see #getForm
*/
public void setForm(String f) {
if (f != INPUT && f != OUTPUT)
throw new IllegalArgumentException("acceptable values are \"input\" or \"output\"");
form = f;
}
/**
* Gets the current type string.
* @return the current type
* @see #setType
*/
public String getType() { return type; }
/**
* Specifies the Java type of the parameter or return value of this action. The most
* common types are int, boolean, String, and void.
* @return the new type
* @see #getType
*/
public void setType(String t) { type = t; }
/**
* Gets the current init string.
* @return the current init
* @see #setInit
*/
public String getInit() { return init; }
/**
* Specifies any initialization code that needs to be present prior to the code generated from
* the action expression. This string must be blank. The feature is not supported in this release.
* @return the new init
* @see #getInit
* @see #setExpr
* @deprecated
*/
public void setInit(String i) {
init = i;
if (init != null && !init.equals("")) {
System.err.println("**Warning: Non-blank initialization strings are not supported in action descriptors");
throw new IllegalArgumentException("initialization string is not supported");
}
}
/**
* Gets the current expression string.
* @return the current expression
* @see #setExpr
*/
public String getExpr() { return expr; }
/**
* Specifies the code fragment that is used to create this action. The following replacement
* variables are allowed in the code fragment:
* %name% the name of the class/bean
* %class% full classname of the class/bean
* %arg% method argument used for input action data
* @return the new expression
* @see #getExpr
*/
public void setExpr(String e) {
expr = e;
if (expr != null && expr.startsWith(".import"))
System.err.println("**Warning: Import specifications are not supported in action descriptors");
}
private String form;
private String type;
private String init;
private String expr;
}