public final class FormatBundle extends Object
You can either create a bundle with all builtin format attributes (see
below for the list), or an empty one which you have to fill yourself. The
methods to use for these are respectively defaultBundle() and newBundle().
The default bundle will contain validators (FormatAttribute
instances) for the following format attributes:
date-time,email,host-name,ip-address,ipv6,regex,uri,Other format attributes defined by the specification are hosted in a different package: json-schema-formats.
you can override these, but it is not advised that you do so: they
have been carefully designed so as to conform to the specification as closely
as possible -- in particular, leave regex alone (see
RhinoHelper).
FormatAttribute| Modifier and Type | Method and Description |
|---|---|
static FormatBundle |
defaultBundle()
Create a new bundle with the default format attribute set
|
Map<String,FormatAttribute> |
getAttributes()
Get an immutable map of this bundle's attributes
|
void |
mergeWith(FormatBundle other)
Merge with another bundle
|
static FormatBundle |
newBundle()
Create a new, empty bundle
|
void |
registerFormat(String fmt,
FormatAttribute attribute)
Register a new format attribute
|
String |
toString() |
void |
unregisterFormat(String fmt)
Unregister a attribute
|
public static FormatBundle newBundle()
public static FormatBundle defaultBundle()
public void registerFormat(String fmt, FormatAttribute attribute)
Note: it will unconditionally override any existing attribute, so be careful!
fmt - the format attribute nameattribute - the attribute instancepublic void unregisterFormat(String fmt)
fmt - the attribute namepublic void mergeWith(FormatBundle other)
Note that attributes defined in the bundle given as an argument will happily override those defined in the current bundle. Use with care!
other - the other bundlepublic Map<String,FormatAttribute> getAttributes()
Copyright © 2012. All Rights Reserved.