public final class ErrorSet extends Object implements NestableData<ErrorSet>
Modifier and Type | Class and Description |
---|---|
static class |
ErrorSet.Builder
Builder class for creating an Error set.
|
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_KEY |
static String |
REL_KEY
Serialization constant definitions
|
Constructor and Description |
---|
ErrorSet()
Constructor.
|
ErrorSet(com.google.common.collect.Multimap<String,String> errors)
Constructor.
|
ErrorSet(com.google.common.collect.Multimap<String,String> errors,
com.google.common.collect.Multimap<String,ErrorSet> relations)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static ErrorSet |
fromError(String key,
String error)
Factory constructor.
|
Collection<String> |
getDataValue(String key)
Get errors for a key.
|
com.google.common.collect.Multimap<String,String> |
getErrors()
Get the top-level errors.
|
com.google.common.collect.Multimap<String,ErrorSet> |
getRelations()
Get the bundle's relation bundles.
|
List<ErrorSet> |
getRelations(String relation)
Get a set of relations.
|
int |
hashCode() |
boolean |
hasRelations(String relation) |
boolean |
isEmpty()
Is this ErrorSet empty? It will be if there are
no errors and none of the relations have errors.
|
ErrorSet |
removeDataValue(String key) |
ErrorSet |
replaceRelations(com.google.common.collect.Multimap<String,ErrorSet> relations) |
Map<String,Object> |
toData()
Serialize a error set to raw data.
|
String |
toJson()
Serialize a error set to a JSON string.
|
String |
toString() |
ErrorSet |
withDataValue(String key,
Object err)
Set a value in the bundle's data.
|
ErrorSet |
withRelation(String relation,
ErrorSet other)
Add a bundle for a particular relation.
|
ErrorSet |
withRelations(com.google.common.collect.Multimap<String,ErrorSet> newRelations)
Add entire set of relations.
|
ErrorSet |
withRelations(String relation,
List<ErrorSet> others)
Set bundles for a particular relation.
|
public static final String REL_KEY
public static final String ERROR_KEY
public ErrorSet()
public ErrorSet(com.google.common.collect.Multimap<String,String> errors)
errors
- A map of top-level errorspublic static ErrorSet fromError(String key, String error)
key
- The property key in errorerror
- The string description of the property errorpublic Collection<String> getDataValue(String key)
getDataValue
in interface NestableData<ErrorSet>
key
- A property keypublic com.google.common.collect.Multimap<String,String> getErrors()
public com.google.common.collect.Multimap<String,ErrorSet> getRelations()
getRelations
in interface NestableData<ErrorSet>
public ErrorSet withRelations(com.google.common.collect.Multimap<String,ErrorSet> newRelations)
withRelations
in interface NestableData<ErrorSet>
newRelations
- A map of relationspublic List<ErrorSet> getRelations(String relation)
getRelations
in interface NestableData<ErrorSet>
relation
- A relation labelpublic boolean hasRelations(String relation)
hasRelations
in interface NestableData<ErrorSet>
public ErrorSet replaceRelations(com.google.common.collect.Multimap<String,ErrorSet> relations)
replaceRelations
in interface NestableData<ErrorSet>
public ErrorSet withDataValue(String key, Object err)
withDataValue
in interface NestableData<ErrorSet>
key
- A property keyerr
- A description of the errorpublic ErrorSet removeDataValue(String key)
removeDataValue
in interface NestableData<ErrorSet>
public ErrorSet withRelations(String relation, List<ErrorSet> others)
withRelations
in interface NestableData<ErrorSet>
relation
- A relation labelothers
- A set of relation error setspublic ErrorSet withRelation(String relation, ErrorSet other)
withRelation
in interface NestableData<ErrorSet>
relation
- A relation labelother
- An error set relationpublic String toJson()
public boolean isEmpty()
Copyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.