# com.bea.ide.lang.java
JavaDocumentFactory Class

public class JavaDocumentFactory
extends `DefaultDocumentHandler`
implements `IRelatedDocumentHandler`

Hierarchy
  `Object`
  `DefaultDocumentHandler`
  `JavaDocumentFactory`

All Implemented Interfaces
  `IDocumentHandler`, `IRelatedDocumentHandler`

## Field Summary

`public static final `String`` | `EXTENSION` String

## Constructor Summary

JavaDocumentFactory() Creates a document factory capable of handling .java documents.
JavaDocumentFactory(`String` ext) Creates a document factory capable of handling documents with the specified extension.

## Method Summary

`public `IDocument`` | `createDocumentObject`(`URI` uriFile) This method must be implemented by derived classes to create the actual IDocument interface that this handler provides.
`public `URI`` | `getParentDocument`(`URI` uriFile) Returns the URI of a document that should appear as the specified document's parent in the UI.
`protected `Reader`` | `getTemplate`(`URI` uriFile, `String` sTemplateId) Creates a template for a new Java file.
`public `String`` | `invalidNameCheck`(`String` sFile) Checks the given filename to see if it is a valid name for this handler.
`public boolean` | `isAutogenerated`(`URI` uriFile) We're never autogenerated, only partly-autogenerated which doesn't count.

Methods from `com.bea.ide.document.`DefaultDocumentHandler``
``createNewFile`, `getBaseName`, `getDefaultExtension`, `getExtension`, `getHandlerId`, `openDocument`, `resolveUnknownPriority`, `suggestValidName``

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.bea.ide.document.`IDocumentHandler``
``createNewFile`, `getBaseName`, `getDefaultExtension`, `getHandlerId`, `invalidNameCheck`, `openDocument`, `resolveUnknownPriority`, `suggestValidName``

Methods from interface `com.bea.ide.document.`IRelatedDocumentHandler``
``getParentDocument`, `isAutogenerated``

## Field Detail

### EXTENSION

    public static final String EXTENSION

## Constructor Detail

### JavaDocumentFactory

    public JavaDocumentFactory()

  Creates a document factory capable of handling .java documents.

### JavaDocumentFactory

    public JavaDocumentFactory(String ext)

  Creates a document factory capable of handling documents with the specified extension.

## Method Detail

### createDocumentObject(URI) Method

    public IDocument createDocumentObject(URI uriFile)
         throws IOException

Description copied from `DefaultDocumentHandler.createDocumentObject(URI)`
This method must be implemented by derived classes to create the actual IDocument interface that this handler provides. It is expected that uriFile exists.

Overrides
  `DefaultDocumentHandler.createDocumentObject(URI)`

#### Parameters

uriFile
  Name of the existing file to create the IDocument interface for

#### Returns

An object implementing the IDocument interface that represents the contents of the given file

#### Exceptions

``IOException``

Related Topics

``DefaultDocumentHandler.createDocumentObject(URI)``

### getParentDocument(URI) Method

    public URI getParentDocument(URI uriFile)

Returns the URI of a document that should appear as the specified document's parent in the UI. This often returns null, indicating that the file should appear as if it is a child only of its enclosing directory.

#### Parameters

uriFile
  the document for which a parent is desired

#### Returns

The parent file of this document.

### getTemplate(URI, String) Method

    protected Reader getTemplate(URI uriFile,
                                 String sTemplateId)

Creates a template for a new Java file. Java files contain an empty class or interface whose name matches that of the file on disk.

Overrides
  `DefaultDocumentHandler.getTemplate(URI, String)`

#### Parameters

uriFile
  Name of the new file being created

#### Returns

A java.io.Reader object that will be used to write the contents of the new file

Related Topics

``DefaultDocumentHandler.getTemplate(URI, String)``

### invalidNameCheck(String) Method

    public String invalidNameCheck(String sFile)

Description copied from `IDocumentHandler.invalidNameCheck(String)`
Checks the given filename to see if it is a valid name for this handler. This check may include verification of the extension and any other requirements on the filename. For example, the java handler can require that the filename be a valid java identifier.

Overrides
  `DefaultDocumentHandler.invalidNameCheck(String)`

#### Parameters

sFile
  The filename that should be examined for validity. This should not contain any path information (i.e. directory or separators).

#### Returns

String value indicating the error message that should be shown to the user or null if the name is valid.

Related Topics

``DefaultDocumentHandler.invalidNameCheck(String)``

### isAutogenerated(URI) Method

    public boolean isAutogenerated(URI uriFile)

We're never autogenerated, only partly-autogenerated which doesn't count.

#### Parameters

uriFile
  File to check for autogeneration

#### Returns

true if the given uri is a file that was completely generated from the contents of another file.