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

## org.infinispan.schematic.internal.schema
Class ValidationResult

    java.lang.Object
      org.infinispan.schematic.internal.schema.ValidationResult

All Implemented Interfaces:
  Iterable<SchemaLibrary.Problem>, Problems, SchemaLibrary.Results

    @NotThreadSafe
    public class ValidationResult

extends Object
implements SchemaLibrary.Results, Problems

Basic implementation of `SchemaLibrary.Results` to which problems can be added.

Since:
  5.1
Author:
  Randall Hauch (C) 2011 Red Hat Inc.

Constructor Summary
`ValidationResult()`

Method Summary
`void` | `add(SchemaLibrary.Problem problem)`
`void` | `addAll(Iterable<SchemaLibrary.Problem> results)`
`void` | `addAll(Iterator<SchemaLibrary.Results> iter)`
`int` | `errorCount()` Determine the number of errors within these results.
`boolean` | `hasErrors()` Determine if these results contain at least one error.
`boolean` | `hasOnlyTypeMismatchErrors()` Determine if these results contain only errors that are `mismatched fields`, where the value of a field has a type that does not match but can be converted to the type defined in the schema.
`boolean` | `hasProblems()` Determine if these results contain at least one error or warning.
`boolean` | `hasWarnings()` Determine if these results contain at least one warning.
`Iterator<SchemaLibrary.Problem>` | `iterator()`
`int` | `problemCount()` Determine the number of problems (that is, errors and warnings) within these results.
`void` | `recordError(Path path, String reason)` Record an error at the given path in a document.
`void` | `recordError(Path path, String reason, Throwable cause)` Record an error at the given path in a document.
`void` | `recordIn(Problems otherProblems)`
`void` | `recordSuccess()` Record a successful validation.
`void` | `recordTypeMismatch(Path path, String reason, JsonSchema.Type actualType, Object actualValue, JsonSchema.Type requiredType, Object convertedValue)` Record a field value was encountered whose type was not the expected type but could be converted to the expected type.
`void` | `recordWarning(Path path, String reason)` Record a warning at the given path in a document.
`int` | `successCount()`
`String` | `toString()`
`int` | `warningCount()` Determine the number of warnings within these results.

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

Constructor Detail

### ValidationResult

    public ValidationResult()

Method Detail

### iterator

    public Iterator<SchemaLibrary.Problem> iterator()

  Specified by:
    `iterator` in interface `Iterable<SchemaLibrary.Problem>`

### hasProblems

    public boolean hasProblems()

  Description copied from interface: `SchemaLibrary.Results`
  Determine if these results contain at least one error or warning. Calling this method is equivalent to (but more efficient than) calling:

       hasErrors() || hasWarnings()

  or

       problemCount() != 0

  or

       errorCount() != 0 || warningCount() != 0

  Specified by:
    `hasProblems` in interface `SchemaLibrary.Results`
  Returns:
    `true` if there is at least one error or warning, or `false` if there are no errors or warnings

### hasErrors

    public boolean hasErrors()

  Description copied from interface: `SchemaLibrary.Results`
  Determine if these results contain at least one error.

  Specified by:
    `hasErrors` in interface `SchemaLibrary.Results`
  Returns:
    `true` if there is at least one error, or `false` if there are no errors

### hasWarnings

    public boolean hasWarnings()

  Description copied from interface: `SchemaLibrary.Results`
  Determine if these results contain at least one warning.

  Specified by:
    `hasWarnings` in interface `SchemaLibrary.Results`
  Returns:
    `true` if there is at least one warning, or `false` if there are no errors

### hasOnlyTypeMismatchErrors

    public boolean hasOnlyTypeMismatchErrors()

  Description copied from interface: `SchemaLibrary.Results`
  Determine if these results contain only errors that are `mismatched fields`, where the value of a field has a type that does not match but can be converted to the type defined in the schema.

  All type mismatch errors are considered `errors`, but not all errors are type mismatch errors.

  If this method return true, then consider calling `SchemaLibrary.convertValues(Document, Results)` to convert the mismatched values and then revalidating.

  Specified by:
    `hasOnlyTypeMismatchErrors` in interface `SchemaLibrary.Results`
  Returns:
    `true` if there is at least one mismatched type error, or `false` if there are no errors
  See Also:
    `SchemaLibrary.convertValues(Document, Results)`

### errorCount

    public int errorCount()

  Description copied from interface: `SchemaLibrary.Results`
  Determine the number of errors within these results.

  Specified by:
    `errorCount` in interface `SchemaLibrary.Results`
  Returns:
    the number of errors; always 0 or a positive number

### warningCount

    public int warningCount()

  Description copied from interface: `SchemaLibrary.Results`
  Determine the number of warnings within these results.

  Specified by:
    `warningCount` in interface `SchemaLibrary.Results`
  Returns:
    the number of warnings; always 0 or a positive number

### problemCount

    public int problemCount()

  Description copied from interface: `SchemaLibrary.Results`
  Determine the number of problems (that is, errors and warnings) within these results.

  Specified by:
    `problemCount` in interface `SchemaLibrary.Results`
  Returns:
    the number of errors and warnings; always 0 or a positive number

### successCount

    public int successCount()

### recordSuccess

    public void recordSuccess()

  Description copied from interface: `Problems`
  Record a successful validation.

  Specified by:
    `recordSuccess` in interface `Problems`

### recordError

    public void recordError(Path path,
                            String reason)

  Description copied from interface: `Problems`
  Record an error at the given path in a document.

  Specified by:
    `recordError` in interface `Problems`
  Parameters:
    `path` - the path; may not be null
    `reason` - the message describing the error; may not be null

### recordError

    public void recordError(Path path,
                            String reason,
                            Throwable cause)

  Description copied from interface: `Problems`
  Record an error at the given path in a document.

  Specified by:
    `recordError` in interface `Problems`
  Parameters:
    `path` - the path; may not be null
    `reason` - the message describing the error; may not be null
    `cause` - the exception that occurred and that is considered the cause

### recordWarning

    public void recordWarning(Path path,
                              String reason)

  Description copied from interface: `Problems`
  Record a warning at the given path in a document.

  Specified by:
    `recordWarning` in interface `Problems`
  Parameters:
    `path` - the path; may not be null
    `reason` - the message describing the warning; may not be null

### recordTypeMismatch

    public void recordTypeMismatch(Path path,
                                   String reason,
                                   JsonSchema.Type actualType,
                                   Object actualValue,
                                   JsonSchema.Type requiredType,
                                   Object convertedValue)

  Description copied from interface: `Problems`
  Record a field value was encountered whose type was not the expected type but could be converted to the expected type.

  Specified by:
    `recordTypeMismatch` in interface `Problems`
  Parameters:
    `path` - the path; may not be null
    `reason` - the message describing the warning; may not be null
    `actualType` - the actual type of the field value; may not be null
    `actualValue` - the actual field value
    `requiredType` - the expected type; may not be null
    `convertedValue` - the converted value

### recordIn

    public void recordIn(Problems otherProblems)

### add

    public void add(SchemaLibrary.Problem problem)

### addAll

    public void addAll(Iterable<SchemaLibrary.Problem> results)

### addAll

    public void addAll(Iterator<SchemaLibrary.Results> iter)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.