Arch4J generator 1.1

org.arch4j.generator
Class JavaInterfaceDefinition

java.lang.Object
  |
  +--org.arch4j.generator.JavaDefinition
        |
        +--org.arch4j.generator.JavaObjectDefinition
              |
              +--org.arch4j.generator.JavaInterfaceDefinition
All Implemented Interfaces:
JavaKeywordConstants, JavaPrimitiveConstants

public class JavaInterfaceDefinition
extends JavaObjectDefinition

This class is used to define the attributes of a Java interface. The attributes can then be used to generate a valid Java interface definition string.

The number of constructors are meant to make it easy to define an interface with as few statements as possible. Once constructed, additional methods can be sent to further define the interface.

Version:
1.0
Author:
Ross E. Greinke

Field Summary
protected  List superInterfaces
          A list of superinterfaces, expressed as JavaType objects.
 
Fields inherited from class org.arch4j.generator.JavaObjectDefinition
implementedInterfaces, isStrict, objectName
 
Fields inherited from class org.arch4j.generator.JavaDefinition
accessModifier, comment
 
Fields inherited from interface org.arch4j.generator.JavaKeywordConstants
ABSTRACT, CATCH, CLASS, DEFAULT_ACCESS, EXTENDS, FALSE, FINAL, FINALLY, IMPLEMENTS, IMPORT, INTERFACE, NATIVE, NEW, NULL, PACKAGE, PRIVATE, PROTECTED, PUBLIC, RETURN, STATIC, STRICTFP, SUPER, SYNCHRONIZED, THIS, THROW, THROWS, TRANSIENT, TRUE, TRY, VOID, VOLATILE
 
Fields inherited from interface org.arch4j.generator.JavaPrimitiveConstants
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT
 
Constructor Summary
JavaInterfaceDefinition(JavaType interfaceName)
          Constructs a JavaInterfaceDefinition with the specified Java interface type.
JavaInterfaceDefinition(JavaType interfaceName, JavaType superInterfaceName)
          Constructs a JavaInterfaceDefinition with the specified Java interface type and superinterface type.
JavaInterfaceDefinition(String interfaceName)
          Constructs a JavaInterfaceDefinition with the specified interface name.
JavaInterfaceDefinition(String comment, JavaAccessModifier accessModifier, boolean isStrict, JavaType interfaceName, List superInterfaces, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, whether the object needs strictfp floating-point calculations, the Java interface type, list of superinterfaces, and list of implemented interfaces.
JavaInterfaceDefinition(String comment, JavaAccessModifier accessModifier, JavaType interfaceName)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, and Java interface type.
JavaInterfaceDefinition(String comment, JavaAccessModifier accessModifier, JavaType interfaceName, JavaType superInterfaceName)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, and superinterface type.
JavaInterfaceDefinition(String comment, JavaAccessModifier accessModifier, JavaType interfaceName, JavaType superInterfaceName, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, superinterface type, and list of implemented interfaces.
JavaInterfaceDefinition(String comment, JavaAccessModifier accessModifier, JavaType interfaceName, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, and list of implemented interfaces.
JavaInterfaceDefinition(String comment, JavaAccessModifier accessModifier, JavaType interfaceName, List superInterfaces, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, list of superinterfaces, and list of implemented interfaces.
JavaInterfaceDefinition(String interfaceName, String superInterfaceName)
          Constructs a JavaInterfaceDefinition with the specified interface name and superinterface name.
JavaInterfaceDefinition(String comment, String accessModifier, boolean isStrict, String interfaceName, List superInterfaces, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, whether the object needs strictfp floating-point calculations, the interface name, list of superinterfaces, and list of implemented interfaces.
JavaInterfaceDefinition(String comment, String accessModifier, String interfaceName)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, and interface name.
JavaInterfaceDefinition(String comment, String accessModifier, String interfaceName, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, and list of implemented interfaces.
JavaInterfaceDefinition(String comment, String accessModifier, String interfaceName, List superInterfaces, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, list of superinterfaces, and list of implemented interfaces.
JavaInterfaceDefinition(String comment, String accessModifier, String interfaceName, String superInterfaceName)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, and superinterface name.
JavaInterfaceDefinition(String comment, String accessModifier, String interfaceName, String superInterfaceName, List implementedInterfaces)
          Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, superinterface name, and list of implemented interfaces.
 
Method Summary
 void addSuperInterface(JavaType interfaceType)
          Add an interface that this interface extends.
 void addSuperInterface(String interfaceName)
          Add an interface that this interface extends.
 void addSuperInterfaces(List interfaces)
          Add a list of interfaces that this interface extends.
 List getImports()
          Returns a list of potential import types for the object.
 String getName()
          Returns the name of this interface.
 String getObjectKeyword()
          Returns the object keyword for the object.
 String getPackageName()
          Returns the package within which this interface is defined.
 List getSuperInterfaces()
          Returns a List of interfaces that this interface extends.
 boolean isAbstract()
          Returns true, because interfaces are always abstract.
 boolean isInterfaceDefinition()
          Returns that this class is an interface definition.
protected  void setSuperInterfaces(List superInterfaces)
          Set the list of superinterfaces that the interface extends.
 void writeDefinitionTo(CodeBuffer buffer)
          Write the Java source representation of the definition to the CodeBuffer.
 
Methods inherited from class org.arch4j.generator.JavaObjectDefinition
addImplementedInterface, addImplementedInterface, addImplementedInterfaces, getImplementedInterfaces, getObjectName, isClassDefinition, isStrict, setImplementedInterfaces, setStrict
 
Methods inherited from class org.arch4j.generator.JavaDefinition
getAccessModifier, getComment, getDefinition, hasComment, setAccessModifier, setComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

superInterfaces

protected List superInterfaces
A list of superinterfaces, expressed as JavaType objects.

Constructor Detail

JavaInterfaceDefinition

public JavaInterfaceDefinition(String interfaceName)
Constructs a JavaInterfaceDefinition with the specified interface name. The access control modifier defaults to public access.

Parameters:
interfaceName - The interface name.

JavaInterfaceDefinition

public JavaInterfaceDefinition(JavaType interfaceName)
Constructs a JavaInterfaceDefinition with the specified Java interface type. The access control modifier defaults to public access.

Parameters:
interfaceName - The interface's Java type specification.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String interfaceName,
                               String superInterfaceName)
Constructs a JavaInterfaceDefinition with the specified interface name and superinterface name. A superinterface is an interface that this interface extends. The access control modifier defaults to public access.

Parameters:
interfaceName - The interface name.
superInterfaceName - The superinterface name.

JavaInterfaceDefinition

public JavaInterfaceDefinition(JavaType interfaceName,
                               JavaType superInterfaceName)
Constructs a JavaInterfaceDefinition with the specified Java interface type and superinterface type. A superinterface is an interface that this interface extends. The access control modifier defaults to public access.

Parameters:
interfaceName - The interface's Java type specification.
superInterfaceName - The superinterface Java type specification.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               String accessModifier,
                               String interfaceName)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, and interface name.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface name.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               JavaAccessModifier accessModifier,
                               JavaType interfaceName)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, and Java interface type.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface's Java type specification.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               String accessModifier,
                               String interfaceName,
                               String superInterfaceName)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, and superinterface name. A superinterface is an interface that this interface extends.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface name.
superInterfaceName - The superinterface name.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               JavaAccessModifier accessModifier,
                               JavaType interfaceName,
                               JavaType superInterfaceName)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, and superinterface type. A superinterface is an interface that this interface extends.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface's Java type specification.
superInterfaceName - The superinterface Java type specification.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               String accessModifier,
                               String interfaceName,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, and list of implemented interfaces. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface name.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               JavaAccessModifier accessModifier,
                               JavaType interfaceName,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, and list of implemented interfaces. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface's Java type specification.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               String accessModifier,
                               String interfaceName,
                               String superInterfaceName,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, superinterface name, and list of implemented interfaces. A superinterface is an interface that this interface extends. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface name.
superInterfaceName - The superinterface name.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               JavaAccessModifier accessModifier,
                               JavaType interfaceName,
                               JavaType superInterfaceName,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, superinterface type, and list of implemented interfaces. A superinterface is an interface that this interface extends. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface's Java type specification.
superInterfaceName - The superinterface Java type specification.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               String accessModifier,
                               String interfaceName,
                               List superInterfaces,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, interface name, list of superinterfaces, and list of implemented interfaces. A superinterface is an interface that this interface extends. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface name.
superInterfaces - The list of superinterfaces.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               JavaAccessModifier accessModifier,
                               JavaType interfaceName,
                               List superInterfaces,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, Java interface type, list of superinterfaces, and list of implemented interfaces. A superinterface is an interface that this interface extends. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface's Java type specification.
superInterfaces - The list of superinterfaces.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               String accessModifier,
                               boolean isStrict,
                               String interfaceName,
                               List superInterfaces,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, whether the object needs strictfp floating-point calculations, the interface name, list of superinterfaces, and list of implemented interfaces. A superinterface is an interface that this interface extends. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface name.
superInterfaces - The list of superinterfaces.
implementedInterfaces - The list of implemented interfaces.

JavaInterfaceDefinition

public JavaInterfaceDefinition(String comment,
                               JavaAccessModifier accessModifier,
                               boolean isStrict,
                               JavaType interfaceName,
                               List superInterfaces,
                               List implementedInterfaces)
Constructs a JavaInterfaceDefinition with the specified comment, access control modifier, whether the object needs strictfp floating-point calculations, the Java interface type, list of superinterfaces, and list of implemented interfaces. A superinterface is an interface that this interface extends. The list should contain JavaType objects representing each interface that this interface implements. Strings will be converted, though, if it is more convenient to use Strings.

Parameters:
comment - The interface's descriptive comment.
accessModifier - The interface's access control modifier.
interfaceName - The interface's Java type specification.
superInterfaces - The list of superinterfaces.
implementedInterfaces - The list of implemented interfaces.
Method Detail

getPackageName

public String getPackageName()
Returns the package within which this interface is defined.

Returns:
The package within which this interface is defined.

getName

public String getName()
Returns the name of this interface.

Returns:
The name of this interface.

getSuperInterfaces

public List getSuperInterfaces()
Returns a List of interfaces that this interface extends.

Returns:
A List of interfaces that this interface extends.

addSuperInterface

public void addSuperInterface(String interfaceName)
Add an interface that this interface extends. The interface name may include the package name.

Parameters:
interfaceName - The interface name.

addSuperInterface

public void addSuperInterface(JavaType interfaceType)
Add an interface that this interface extends. The interface is expressed as a Java type.

Parameters:
interfaceType - The interface type.

addSuperInterfaces

public void addSuperInterfaces(List interfaces)
Add a list of interfaces that this interface extends.

Parameters:
interfaces - The list of interface names or types to add.

isInterfaceDefinition

public boolean isInterfaceDefinition()
Returns that this class is an interface definition.

Overrides:
isInterfaceDefinition in class JavaObjectDefinition
Returns:
true; this class is an interface definition.

getObjectKeyword

public String getObjectKeyword()
Description copied from class: JavaObjectDefinition
Returns the object keyword for the object.

Specified by:
getObjectKeyword in class JavaObjectDefinition
Returns:
The object keyword for the object.

isAbstract

public boolean isAbstract()
Returns true, because interfaces are always abstract.

Specified by:
isAbstract in class JavaObjectDefinition
Returns:
true, because interfaces are always abstract.

getImports

public List getImports()
Description copied from class: JavaObjectDefinition
Returns a list of potential import types for the object. It should be a List of JavaType objects.

Overrides:
getImports in class JavaObjectDefinition
Returns:
A list of potential import types for the object.

writeDefinitionTo

public void writeDefinitionTo(CodeBuffer buffer)
Description copied from class: JavaDefinition
Write the Java source representation of the definition to the CodeBuffer.

Specified by:
writeDefinitionTo in class JavaDefinition
Parameters:
buffer - The CodeBuffer with which to append the data.
See Also:
CodeBuffer

setSuperInterfaces

protected void setSuperInterfaces(List superInterfaces)
Set the list of superinterfaces that the interface extends.

Parameters:
superInterfaces - The list of superinterfaces.

Arch4J generator 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.