public class Meta extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Meta.Concept |
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_KEY |
static List<Meta.Concept> |
KNOWN_CONCEPTS |
Constructor and Description |
---|
Meta() |
Modifier and Type | Method and Description |
---|---|
Meta |
add(String key,
Object information)
Add a piece of meta information.
|
Meta |
addErrors(List<BulletError> errors)
Add errors to the Meta.
|
static void |
addIfNonNull(Map<String,Object> meta,
Map<String,String> names,
Meta.Concept concept,
Supplier<Object> supplier)
Utility function to add a concept with a configured name to a map representing metadata if both the name and
and a value for the name produced by a given
Supplier are not null. |
Map<String,Object> |
asMap()
Returns a backing view of the meta information as a Map.
|
static void |
consumeRegisteredConcept(Meta.Concept concept,
Map<String,String> names,
Consumer<String> action)
Utility function to apply a method for a given
Meta.Concept name if provided in the given Map of names. |
Meta |
merge(Meta meta)
Merge another Meta into this Meta.
|
static Meta |
of(BulletError... errors)
Static construction of Meta with some errors.
|
static Meta |
of(List<BulletError> errors)
Static construction of Meta with some errors.
|
public static final List<Meta.Concept> KNOWN_CONCEPTS
public static final String ERROR_KEY
public Map<String,Object> asMap()
public Meta add(String key, Object information)
key
- The name of the meta taginformation
- An object that represents the information.public Meta addErrors(List<BulletError> errors)
errors
- BulletError
objects to add.public static Meta of(BulletError... errors)
errors
- A non-null List
of BulletError
objects.public static Meta of(List<BulletError> errors)
errors
- A non-null list of BulletError
objects.public Meta merge(Meta meta)
meta
- A Meta to merge.public static void addIfNonNull(Map<String,Object> meta, Map<String,String> names, Meta.Concept concept, Supplier<Object> supplier)
Supplier
are not null.meta
- The non-null Map
representing the metadata.names
- The non-null Map
of configured Meta.Concept
names to key names to use.concept
- The concept to addsupplier
- A Supplier
that can produce a value to add to the metadata for the concept. If the
supplier produces null, it is not added.public static void consumeRegisteredConcept(Meta.Concept concept, Map<String,String> names, Consumer<String> action)
Meta.Concept
name if provided in the given Map
of names.concept
- The concept to check in the map if present.names
- A non-null map of concept names to their key names.action
- The action to apply if the concept was provided in the map.Copyright © 2021. All rights reserved.