sk.uniba.euromath.editor.widgets
Enum FileRequirementsEnum

java.lang.Object
  extended by java.lang.Enum<FileRequirementsEnum>
      extended by sk.uniba.euromath.editor.widgets.FileRequirementsEnum
All Implemented Interfaces:
Serializable, Comparable<FileRequirementsEnum>

public enum FileRequirementsEnum
extends Enum<FileRequirementsEnum>

Constants containing requirements for given file object.

Author:
Martin Vysny

Enum Constant Summary
MUST_BE_CREATABLE_DIRECTORY
          Object must be able to be created as a directory.
MUST_BE_CREATABLE_FILE
          Object must be able to be created as a file.
MUST_BE_DIRECTORY
          Object must be directory.
MUST_BE_FILE
          Object must be file.
OBJECT_MUST_EXIST
          Object (file/directory) must exist.
OBJECT_MUST_NOT_EXIST
          Object (file/directory) must not exist.
PATH_MUST_EXIST
          Path to object (file/directory) must exist.
PATH_MUST_NOT_EXIST
          Path to object (file/directory) must not exist.
 
Method Summary
static ValidityMessages check(File file, ValidityMessages current, Map<FileRequirementsEnum,MessageLevelEnum> flags)
          Checks given file against all flags.
 ValidityMessages check(File file, ValidityMessages current, MessageLevelEnum level)
          Checks if given file complies the flag.
abstract  String complies(File file, MessageLevelEnum level)
          Checks if given file complies the flag.
static FileRequirementsEnum valueOf(String name)
          Returns the enum constant of this type with the specified name.
static FileRequirementsEnum[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

OBJECT_MUST_EXIST

public static final FileRequirementsEnum OBJECT_MUST_EXIST
Object (file/directory) must exist.


OBJECT_MUST_NOT_EXIST

public static final FileRequirementsEnum OBJECT_MUST_NOT_EXIST
Object (file/directory) must not exist.


PATH_MUST_EXIST

public static final FileRequirementsEnum PATH_MUST_EXIST
Path to object (file/directory) must exist.


PATH_MUST_NOT_EXIST

public static final FileRequirementsEnum PATH_MUST_NOT_EXIST
Path to object (file/directory) must not exist.


MUST_BE_FILE

public static final FileRequirementsEnum MUST_BE_FILE
Object must be file. This flag sets validity message only when object exists.


MUST_BE_DIRECTORY

public static final FileRequirementsEnum MUST_BE_DIRECTORY
Object must be directory. This flag sets validity message only when object exists.


MUST_BE_CREATABLE_FILE

public static final FileRequirementsEnum MUST_BE_CREATABLE_FILE
Object must be able to be created as a file. Not checked when path to object does not exist.


MUST_BE_CREATABLE_DIRECTORY

public static final FileRequirementsEnum MUST_BE_CREATABLE_DIRECTORY
Object must be able to be created as a directory. Not checked when path to object does not exist.

Method Detail

values

public static final FileRequirementsEnum[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(FileRequirementsEnum c : FileRequirementsEnum.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static FileRequirementsEnum valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

check

public final ValidityMessages check(File file,
                                    ValidityMessages current,
                                    MessageLevelEnum level)
Checks if given file complies the flag. If not then appropriate message is set.

Parameters:
file - file to check.
current - current messages object. May be null.
level - level of message
Returns:
messages object instance. May be null only if 'current' was null and file complies the flag's requirements.

complies

public abstract String complies(File file,
                                MessageLevelEnum level)
Checks if given file complies the flag. If not then appropriate message is set.

Parameters:
file - file to check.
level - the level of compliance, should be used to change error message: error should result in 'should', warning messages should use 'may' words.
Returns:
messages object instance. May be null only if 'current' was null and file complies the flag's requirements.

check

public static ValidityMessages check(File file,
                                     ValidityMessages current,
                                     Map<FileRequirementsEnum,MessageLevelEnum> flags)
Checks given file against all flags.

Parameters:
file - the file to check.
current - current messages object. May be null.
flags - maps flags to their message level.
Returns:
messages object instance. May be null only if 'current' was null and file complies the flag's requirements.


Copyright © 2003-2006 null. All Rights Reserved.