Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.project.validator
Class Validator

    java.lang.Object
      org.apache.cayenne.project.validator.Validator

    public class Validator

extends Object

Validator is used to validate Cayenne projects.

Author:
  Andrus Adamchik

Field Summary
`protected int` | `maxSeverity`
`protected Project` | `project`
`protected List` | `validationResults`

Constructor Summary
`Validator(Project project)` Creates a new validator initialized with the project.
`Validator(Project project, ConfigStatus status)` Initializes validator with the project loading config status.

Method Summary
`int` | `getMaxSeverity()` Returns maximum severity level encountered during the last validation run.
`Project` | `getProject()` Returns the project.
`void` | `registerError(String message, ProjectPath treeNodePath)`
`void` | `registerValidated(int severity, String message, ProjectPath treeNodePath)` Registers validation result.
`void` | `registerWarning(String message, ProjectPath treeNodePath)`
`protected void` | `reset()` Resets internal state.
`int` | `validate()` Validates all project elements.
`int` | `validate(Iterator treeNodes)` Validates a set of tree nodes passed as an iterator.
`List` | `validationResults()` Return collection of ValidationInfo objects from last validation.

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

Field Detail

### project

    protected Project project

### validationResults

    protected List validationResults

### maxSeverity

    protected int maxSeverity

Constructor Detail

### Validator

    public Validator(Project project)

  Creates a new validator initialized with the project.

  Parameters:
    `project` -

### Validator

    public Validator(Project project,
                     ConfigStatus status)

  Initializes validator with the project loading config status.

  Parameters:
    `project` -
    `status` -

Method Detail

### getProject

    public Project getProject()

  Returns the project.

  Returns:
    Project

### reset

    protected void reset()

  Resets internal state. Called internally before starting validation.

### getMaxSeverity

    public int getMaxSeverity()

  Returns maximum severity level encountered during the last validation run.

### registerValidated

    public void registerValidated(int severity,
                                  String message,
                                  ProjectPath treeNodePath)

  Registers validation result. Increases internally stored max severity if `result` parameter has a higher severity then the current value. Leaves current value unchanged otherwise.

### registerError

    public void registerError(String message,
                              ProjectPath treeNodePath)

### registerWarning

    public void registerWarning(String message,
                                ProjectPath treeNodePath)

### validationResults

    public List validationResults()

  Return collection of ValidationInfo objects from last validation.

### validate

    public int validate()

  Validates all project elements.

  Returns:
    ValidationInfo.VALID if no errors were found, or an error code of the error with the highest severity if there were errors.

### validate

    public int validate(Iterator treeNodes)

  Validates a set of tree nodes passed as an iterator.

  Returns:
    ValidationInfo.VALID if no errors were found, or an error code of the error with the highest severity if there were errors.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.