|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.glaivestone.javax.lang.ConstantType
|
+--com.glaivestone.javax.io.FileType
A FileType constant identifies a specific file type
and defines standard attributes such as a brief description
and the extension used with the file type.
Constant definitions are provided for some standard, widely-used
file types that are common in Java programs. File types are an
open-ended set of constants. Additional constants can be created
for file types used in your application using the static
defineConstant service. A file type definition
should typically be used to create a static constant in your application.
This class can be subclassed to provide extended attributes of a FileType.
If so, the constants should be allocated within the ordinal space of the
FileType class itself, i.e., subclasses should not define a separate
ordinal allocation counter and the constants must be registered under this class.
Subclasses must override the static defineConstant method to throw
an IllegalOperationException and implement an equivalent definition
service with parameters for the additional properties defined in the subclass.
| Field Summary | |
java.lang.String |
description
Brief description of this file type. |
java.lang.String |
extension
The file name extension used for this file type. |
static FileType |
GIF
|
static FileType |
HTML
|
static FileType |
JAR
|
static FileType |
JPEG
|
static FileType |
TEXT
|
static FileType |
XML
|
static FileType |
ZIP
|
| Fields inherited from class com.glaivestone.javax.lang.ConstantType |
name, ord |
| Method Summary | |
java.lang.String |
composeFileName(java.lang.String fileBaseName)
Answer the file name formed by appending the receiver's extension to the specified base file name. |
static FileType |
defineConstant(java.lang.String name,
java.lang.String extension,
java.lang.String description)
Creates a constant with the given name and extension and a unique ordinal value. |
static FileType |
getConstant(int ordinalValue)
Answer the constant of this type with the specified ordinal value. |
static FileType |
getConstant(java.lang.String name)
Answer the constant of this type with the specified name. |
boolean |
sameExtension(java.io.File aFile)
Answer whether the specified file has the same extension of this file type. |
| Methods inherited from class com.glaivestone.javax.lang.ConstantType |
getConstant, getConstant, intValue, toConstantName, toDescriptionString, toIdentificationString, toQualifiedConstantName, toSimpleConstantName, toString |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final FileType TEXT
public static final FileType HTML
public static final FileType XML
public static final FileType GIF
public static final FileType JPEG
public static final FileType JAR
public static final FileType ZIP
public final java.lang.String description
public final java.lang.String extension
| Method Detail |
public static FileType defineConstant(java.lang.String name,
java.lang.String extension,
java.lang.String description)
java.lang.IllegalArgumentException - invalid or duplicate propertiespublic static FileType getConstant(int ordinalValue)
public static FileType getConstant(java.lang.String name)
public java.lang.String composeFileName(java.lang.String fileBaseName)
public boolean sameExtension(java.io.File aFile)
|
GFL 1.1 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||