org.enhydra.zeus
Interface Binding

All Known Subinterfaces:
Container, Property

public interface Binding

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.

It also allows for uniformity in mapping. For example, the DTD ELEMENT and XML Schema element constructs, while different, should both be mapped to the same implementation of a Binding in Zeus. In this way, constraints that represent semantically equivalent constructs result in identical sets of bindings.

Author:
Brett McLaughlin
See Also:
DTDBinder, SchemaBinder

Method Summary
 java.lang.String getJavaCollectionClass()
           This will return the Java collection class to use for this binding, if it is a collection.
 java.lang.String getJavaImplementationPackage()
           This will return the Java package name for this binding's implementation class.
 java.lang.String getJavaInterfacePackage()
           This will return the Java package name for this binding's interface class.
 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 getJavaVariableName()
           This will return the Java name that can be used for a variable name in generated code.
 java.lang.String getXMLName()
           This will return the XML name of the binding.
 java.lang.String getXMLNamespaceURI()
           The will return the XML namespace URI associated with the XML name of this binding.
 java.lang.String getXMLParentType()
           This will return the XML local name associated with the XML type of this binding's XML parent.
 java.lang.String getXMLParentTypeNamespaceURI()
           The will return the XML namespace URI associated with the XML type of this binding's XML parent.
 java.lang.String getXMLType()
           This will return the XML local name associated with the XML type of this binding.
 java.lang.String getXMLTypeNamespaceURI()
           The will return the XML namespace URI associated with the XML type of this binding.
 boolean isJavaSerializable()
           This will indicate whether this binding is Java-serializable (indicated by a boolean value of "true"), or not (indicated by a boolean value of "false").
 boolean isXMLRootElement()
           This indicates if this binding represents an XML element that is the root element of the document.
 void setIsJavaSerializable(boolean isJavaSerializable)
           This will set whether this binding should be a Java-serializable class.
 void setIsXMLRootElement(boolean isXMLRootElement)
           This sets whether this binding represents an XML element that is the root element of the document.
 void setJavaCollectionClass(java.lang.String javaCollectionClass)
           This will set the Java collection class to use for this binding, if it is a collection.
 void setJavaImplementationPackage(java.lang.String javaImplementationPackage)
           This will set the Java package for this class's implementation.
 void setJavaInterfacePackage(java.lang.String javaInterfacePackage)
           This will set the Java package for this class's interface.
 void setJavaName(java.lang.String javaName)
           The will set the name of the Java variable associated with this binding.
 void setJavaType(java.lang.String javaType)
           This will set the Java type for this binding.
 void setJavaVariableName(java.lang.String javaVariableName)
           This will set the Java name that can be used for a variable name in generated code.
 void setXMLName(java.lang.String xmlName)
           This will set the XML name of the binding.
 void setXMLNamespaceURI(java.lang.String xmlNameURI)
           The will set the XML namespace URI associated with the XML name of this binding.
 void setXMLParentType(java.lang.String xmlParentType)
           This will set the XML local name associated with the XML type of this binding's XML parent.
 void setXMLParentTypeNamespaceURI(java.lang.String xmlParentTypeNamespaceURI)
           This will set the XML namespace URI associated with the XML type of this binding's XML parent.
 void setXMLType(java.lang.String xmlType)
           This will set the XML local name associated with the XML type of this binding.
 void setXMLTypeNamespaceURI(java.lang.String xmlTypeNamespaceURI)
           This will set the XML namespace URI associated with the XML type of this binding.
 

Method Detail

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 as would be seen in an XML document.

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.

Parameters:
xmlName - the XML name of the binding.

getXMLNamespaceURI

public java.lang.String getXMLNamespaceURI()

The will return the XML namespace URI associated with the XML name of this binding. A value of the empty string indicates that there is no URI associated with the XML name of this binding.

Returns:
String - the XML namespace URI associated with the XML name of this binding, or an empty string if no namespace URI.

setXMLNamespaceURI

public void setXMLNamespaceURI(java.lang.String xmlNameURI)

The will set the XML namespace URI associated with the XML name of this binding. A value of the empty string indicates that there is no URI associated with the XML name of this binding.

Parameters:
xmlNameURI - the XML namespace URI

getXMLType

public java.lang.String getXMLType()

This will return the XML local name associated with the XML type of this binding. When using a DTD, the XML type is the same as the XML name. However, when using an XML Schema, the type may be different from the name.

Returns:
String - the XML local name of the XML type of this binding.

setXMLType

public void setXMLType(java.lang.String xmlType)

This will set the XML local name associated with the XML type of this binding.

Parameters:
xmlType - the XML type.

getXMLTypeNamespaceURI

public java.lang.String getXMLTypeNamespaceURI()

The will return the XML namespace URI associated with the XML type of this binding. A value of the empty string indicates that there is no URI associated with the XML type of this binding.

While this is not useful in DTD binding, it allows types like xsd:string to be distinguished from something like myPrefix:string, which a user might define.

Returns:
String - the XML namespace URI associated with the XML type of this binding.

setXMLTypeNamespaceURI

public void setXMLTypeNamespaceURI(java.lang.String xmlTypeNamespaceURI)

This will set the XML namespace URI associated with the XML type of this binding. A value of the empty string indicates that there is no URI associated with the XML type of this binding.

Parameters:
xmlTypeNamespaceURI - the XML namespace URI.

getXMLParentType

public java.lang.String getXMLParentType()

This will return the XML local name associated with the XML type of this binding's XML parent. When using a DTD, the XML type is the same as the XML name. However, when using an XML Schema, the type may be different from the name.

If there is no parent XML type, such as for the root element of a document, this value is null.

Returns:
String - the XML local name of the XML type of this binding's parent.

setXMLParentType

public void setXMLParentType(java.lang.String xmlParentType)

This will set the XML local name associated with the XML type of this binding's XML parent.

Parameters:
xmlParentType - the XML type for this binding's parent.

getXMLParentTypeNamespaceURI

public java.lang.String getXMLParentTypeNamespaceURI()

The will return the XML namespace URI associated with the XML type of this binding's XML parent. A value of the empty string indicates that there is no URI associated with the XML type of this binding's parent.

While this is not useful in DTD binding, it allows types like xsd:string to be distinguished from something like myPrefix:string, which a user might define.

Returns:
String - the XML namespace URI associated with the XML type of this binding's parent.

setXMLParentTypeNamespaceURI

public void setXMLParentTypeNamespaceURI(java.lang.String xmlParentTypeNamespaceURI)

This will set the XML namespace URI associated with the XML type of this binding's XML parent. A value of the empty string indicates that there is no URI associated with the XML type of this binding's parent.

Parameters:
xmlParentTypeNamespaceURI - the XML namespace URI of the parent type.

setIsXMLRootElement

public void setIsXMLRootElement(boolean isXMLRootElement)

This sets whether this binding represents an XML element that is the root element of the document.

Parameters:
isXMLRootElement - whether this is the root element.

isXMLRootElement

public boolean isXMLRootElement()

This indicates if this binding represents an XML element that is the root element of the document.

Returns:
boolean - whether this is the root element.

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 is the string used to build the methods setXXX() and getXXX(). Note that this is not necessarily the variable name used by the generators, but they will provide the setXXX() and getXXX() based on this name.

Returns:
String - the Java name of the binding.

setJavaName

public void setJavaName(java.lang.String javaName)

The will set the name of the Java variable associated with this binding.

Parameters:
javaName - the new variable name.

getJavaVariableName

public java.lang.String getJavaVariableName()

This will return the Java name that can be used for a variable name in generated code. It is guaranteed to be a legal Java identifier.

To illustrate the difference between the Java name and its variable name, consider this simple example:


   
 
With the above DTD the XML name is "default". However, "default" is a Java keyword, but setDefault() and getDefault() are not illegal. So for a typical name binding, the Java name would be "default" and the variable name would (could) be "safeDefault". The generated interface would still contain setDefault() and getDefault().

Note that it is not necessary for the variable name to always (or even often) be different from the normal Java name.

Returns:
String - the Java variable name.

setJavaVariableName

public void setJavaVariableName(java.lang.String javaVariableName)

This will set the Java name that can be used for a variable name in generated code. This must be a legal Java identifier, and the first character must not be an upper case letter.

Parameters:
javaVariableName - the name to use for the Java member variable.

getJavaInterfacePackage

public java.lang.String getJavaInterfacePackage()

This will return the Java package name for this binding's interface class.

Returns:
String - the Java interface package associated with the binding's Java type.

setJavaInterfacePackage

public void setJavaInterfacePackage(java.lang.String javaInterfacePackage)

This will set the Java package for this class's interface.

Parameters:
javaInterfacePackage - the name of the interface package for this binding.

getJavaImplementationPackage

public java.lang.String getJavaImplementationPackage()

This will return the Java package name for this binding's implementation class.

Returns:
String - the Java implementation package associated with the binding's Java type.

setJavaImplementationPackage

public void setJavaImplementationPackage(java.lang.String javaImplementationPackage)

This will set the Java package for this class's implementation.

Parameters:
javaImplementationPackage - the name of the implementation package for this binding.

getJavaType

public java.lang.String getJavaType()

This will return the Java type associated with the binding. This is not a fully qualified name for the type. To get the fully qualified name for the type prepend the value returned from getJavaPackage() to the value returned by this method (with a "." inserted in between if the package is not the empty string).

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.

Parameters:
javaType - the Java type for this binding.

setJavaCollectionClass

public void setJavaCollectionClass(java.lang.String javaCollectionClass)
                            throws InvalidCollectionTypeException

This will set the Java collection class to use for this binding, if it is a collection. This will be a fully-qualified Java class, such as java.util.List.

Parameters:
javaCollectionClass - the collection class for this binding.
Throws:
InvalidCollectionTypeException - - when the supplied collection class is not a valid collection type.

getJavaCollectionClass

public java.lang.String getJavaCollectionClass()

This will return the Java collection class to use for this binding, if it is a collection. This will be a fully qualified Java class, such as java.util.List.

Returns:
String - the Java collection class for this binding.

setIsJavaSerializable

public void setIsJavaSerializable(boolean isJavaSerializable)

This will set whether this binding should be a Java-serializable class.

Parameters:
isJavaSerializable - whether this binding should be Java serializable (true) or not (false).

isJavaSerializable

public boolean isJavaSerializable()

This will indicate whether this binding is Java-serializable (indicated by a boolean value of "true"), or not (indicated by a boolean value of "false").

Returns:
boolean - whether this binding is Java-serializable.


Copyright © 2002 Enhydra. All Rights Reserved.