org.enhydra.zeus.binding
Class BaseBinding

java.lang.Object
  |
  +--org.enhydra.zeus.binding.BaseBinding
Direct Known Subclasses:
BaseContainer, BaseProperty, ContainerProperty

public abstract class BaseBinding
extends java.lang.Object

Binding represents an arbitrary Java construct, and provides a representation-independent means of showing how a constraint (presumably from an XML Schema, DTD, Relax schema, etc.) maps to Java. It provides a layer of representation between the constraint representation and generated Java.

This implementation of Binding deals with the basic functionality of all bindings. It leaves specific binding implementations to deal with only their functionality.

Version:
1.0
Author:
Brett McLaughlin

Field Summary
protected  java.lang.String javaName
          The Java name of the binding
protected  java.lang.String javaType
          The Java type of the binding
protected  java.lang.String xmlName
          The XML name of the binding
 
Constructor Summary
BaseBinding()
           
 
Method Summary
 java.lang.String getJavaName()
           This will return the Java name of the binding.
 java.lang.String getJavaType()
           This will return the Java type associated with the binding.
 java.lang.String getXMLName()
           This will return the XML name of the binding.
 void setJavaType(java.lang.String javaType)
           This will set the Java type for this binding.
 void setXMLName(java.lang.String xmlName)
           This will set the XML name of the binding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

javaName

protected java.lang.String javaName
The Java name of the binding

xmlName

protected java.lang.String xmlName
The XML name of the binding

javaType

protected java.lang.String javaType
The Java type of the binding
Constructor Detail

BaseBinding

public BaseBinding()
Method Detail

getJavaName

public java.lang.String getJavaName()

This will return the Java name of the binding. This should be the valid Java name of the binding, which is most often a variable name. This name will be the result of any conversions that have to be done if the XML name of the binding is not a valid Java identifier.

For example, for a List that is associated with an instance variable named "myList", invoking getJavaName() would return "myList." For a custom object type "Foo", associated with an instance variable "foo", invoking getJavaName() would return "foo".

It's also important to note that there are cases when this would return null. For an object that is top-level, and is not a member variable of any other object, no name will be associated with the binding.

Returns:
String - the Java name of the binding.

getXMLName

public java.lang.String getXMLName()

This will return the XML name of the binding. This should be the actual XML name of the binding, which is most often a variable name.

For example, for a List that is associated with an instance variable named "myList", invoking getXMLName() would return "myList." For a custom object type "Foo", associated with an instance variable "foo", invoking getJavaName() would return "foo".

It's also important to note that there are cases when this would return null. For an object that is top-level, and is not a member variable of any other object, no name will be associated with the binding.

Returns:
String - the XML name of the binding.

setXMLName

public void setXMLName(java.lang.String xmlName)

This will set the XML name of the binding. For more details on the XML name of a binding, see getXMLName().

Parameters:
xmlName - String XML name of the binding.

getJavaType

public java.lang.String getJavaType()

This will return the Java type associated with the binding. This will always be the fully qualified name of the Java object, excepting cases where the object is in default included packages.

For example, an object of type org.bby.Foo would return "org.bby.Foo" when this method is invoked. However, an object of type java.lang.String would only return "String." In all cases, the type returned here is qualified enough to not require any import statements in generated code.

Returns:
String - the Java type of the binding.

setJavaType

public void setJavaType(java.lang.String javaType)

This will set the Java type for this binding. For more details on Java types and bindings, see getJavaType().

Note: Should this do an internal check in implementations to ensure full qualification, like with Class.forName() or something? If so, notes should be made here to that effect.
Parameters:
javaType - String the Java type for this binding.


Copyright © 2001 Enhydra. All Rights Reserved.