Class MapEntityContext<T>
java.lang.Object
org.keycloak.models.map.storage.file.common.MapEntityContext<T>
- All Implemented Interfaces:
BlockContext<T>
BlockContext
which handles any entity accompanied with EntityField
field getters and setters,
namely Map*Entity
classes.- Author:
- hmlnarik
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from interface org.keycloak.models.map.storage.file.common.BlockContext
BlockContext.DefaultListContext<T>, BlockContext.DefaultMapContext<T>, BlockContext.DefaultObjectContext<T>
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionMapEntityContext
(Class<T> clazz) MapEntityContext
(Class<T> clazz, boolean topContext) protected
MapEntityContext
(Class<T> clazz, Map<String, EntityField<?>> nameToEntityField, Map<String, Supplier<? extends BlockContext<?>>> contextCreators, boolean topContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Modifies theresult returned
from within this context by providing the read mapping entryname
to givenvalue
.protected static <T> Map<String,
Supplier<? extends BlockContext<?>>> fieldsToContextCreators
(Class<T> type) static <T> Map<String,
EntityField<?>> fieldsToEntityField
(Class<T> type) BlockContext<?>
getContext
(String nameOfSubcontext) Called after reading a key of map entry in YAML file and before reading its value.Returns the result of parsing the given part of YAML file.static <T> boolean
setEntityField
(T result, EntityField<? super T> ef, Object value) toString()
void
writeValue
(T entity, WritingMechanism mech) Writes the given value usingWritingMechanism
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.keycloak.models.map.storage.file.common.BlockContext
add
-
Field Details
-
objectClass
-
result
-
SCHEMA_VERSION
- See Also:
-
ATTRIBUTES_NAME
-
-
Constructor Details
-
MapEntityContext
-
MapEntityContext
-
MapEntityContext
protected MapEntityContext(Class<T> clazz, Map<String, EntityField<?>> nameToEntityField, Map<String, Supplier<? extends BlockContext<?>>> contextCreators, boolean topContext)
-
-
Method Details
-
fieldsToContextCreators
protected static <T> Map<String,Supplier<? extends BlockContext<?>>> fieldsToContextCreators(Class<T> type) -
fieldsToEntityField
-
setEntityField
-
add
Description copied from interface:BlockContext
Modifies theresult returned
from within this context by providing the read mapping entryname
to givenvalue
.Called after reading a map entry (both key and value) from the YAML file is finished. The entry is represented as
name
parameter (key part of the entry) andvalue
(value part of the entry).The method is called in the same order as the mapping items appear in the source YAML mapping.
- Specified by:
add
in interfaceBlockContext<T>
-
getScalarType
- Specified by:
getScalarType
in interfaceBlockContext<T>
-
getResult
Description copied from interface:BlockContext
Returns the result of parsing the given part of YAML file.- Specified by:
getResult
in interfaceBlockContext<T>
- Returns:
-
getContext
Description copied from interface:BlockContext
Called after reading a key of map entry in YAML file and before reading its value. The key of the entry is represented asnameOfSubcontext
parameter, and provides means to specify aYamlContext
for transforming the mapping value into appropriate Java object.- Specified by:
getContext
in interfaceBlockContext<T>
- Parameters:
nameOfSubcontext
- Key of the map entry- Returns:
- Context used for transforming the value,
or
null
if the default primitive / sequence / mapping context should be used instead. - See Also:
-
writeValue
Description copied from interface:BlockContext
Writes the given value usingWritingMechanism
.- Specified by:
writeValue
in interfaceBlockContext<T>
-
toString
-