com.github.fge.jsonschema.format.helpers
Class HexStringFormatAttribute

java.lang.Object
  extended by com.github.fge.jsonschema.format.AbstractFormatAttribute
      extended by com.github.fge.jsonschema.format.helpers.HexStringFormatAttribute
All Implemented Interfaces:
FormatAttribute
Direct Known Subclasses:
MD5FormatAttribute, SHA1FormatAttribute, SHA256FormatAttribute, SHA512FormatAttribute

public abstract class HexStringFormatAttribute
extends AbstractFormatAttribute

Base class for hexadecimal string-based representations

This class is particularly useful to validate hexadecimal-based string data. The only two constructor arguments you have to specify are a short description of the validated string and its expected length.

In this package, it is used for validating MD5, SHA1, SHA256 and SHA512 checksums, which are very commonly represented in form of hexadecimal strings of fixed length.


Field Summary
protected  int length
           
 
Constructor Summary
protected HexStringFormatAttribute(String fmt, int length)
           
 
Method Summary
 void validate(ProcessingReport report, MessageBundle bundle, FullData data)
          Validate the instance against this format attribute
 
Methods inherited from class com.github.fge.jsonschema.format.AbstractFormatAttribute
newMsg, supportedTypes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

protected final int length
Constructor Detail

HexStringFormatAttribute

protected HexStringFormatAttribute(String fmt,
                                   int length)
Method Detail

validate

public final void validate(ProcessingReport report,
                           MessageBundle bundle,
                           FullData data)
                    throws ProcessingException
Description copied from interface: FormatAttribute
Validate the instance against this format attribute

Parameters:
report - the report to use
bundle - the message bundle to use
data - the validation data
Throws:
ProcessingException - an exception occurs (normally, never for a format attribute)