Package io.jmix.dynmodel.impl
Class DynamicModelDefinitionYamlSerializer
java.lang.Object
io.jmix.dynmodel.impl.DynamicModelDefinitionYamlSerializer
- All Implemented Interfaces:
DynamicModelDefinitionSerializer
@NullMarked
@Component("dynmod_DynamicModelDefinitionYamlSerializer")
public class DynamicModelDefinitionYamlSerializer
extends Object
implements DynamicModelDefinitionSerializer
Serializes and deserializes dynamic model definitions in YAML format.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final recordThe root of the YAML content. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DynamicModelPackageSupportprotected final com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(String content) protected StringFormats the location of the failure in the content, for exampleline 7, column 21, or returns an empty string when it is not known.protected StringformatPath(List<com.fasterxml.jackson.databind.JsonMappingException.Reference> references) Formats a Jackson reference chain as a YAML path, for exampleentities[0].attributes[2].javaClass.protected DynamicModelDefinitionParseExceptionBuilds an exception whose message can be shown to the user: it says where in the content the problem is - the path of the rejected value in the model and, when it is known, its location in the text, or only the location for a YAML syntax error - and what is wrong with it.protected StringExplains the failure in one line.protected DynamicModelDefinitionsanitizeDefinition(DynamicModelDefinition definition) protected DynamicEntityDefinitionsanitizeEntityDefinition(DynamicEntityDefinition entityDefinition) serialize(DynamicModelDefinition definition) serialize(DynamicModelDefinition definition, @Nullable String existingContent)
-
Field Details
-
mapper
protected final com.fasterxml.jackson.databind.ObjectMapper mapper -
dynamicModelPackageSupport
-
-
Constructor Details
-
DynamicModelDefinitionYamlSerializer
public DynamicModelDefinitionYamlSerializer()
-
-
Method Details
-
serialize
- Specified by:
serializein interfaceDynamicModelDefinitionSerializer
-
serialize
- Specified by:
serializein interfaceDynamicModelDefinitionSerializer
-
deserialize
- Specified by:
deserializein interfaceDynamicModelDefinitionSerializer
-
parseException
Builds an exception whose message can be shown to the user: it says where in the content the problem is - the path of the rejected value in the model and, when it is known, its location in the text, or only the location for a YAML syntax error - and what is wrong with it. -
formatPath
protected String formatPath(List<com.fasterxml.jackson.databind.JsonMappingException.Reference> references) Formats a Jackson reference chain as a YAML path, for exampleentities[0].attributes[2].javaClass. The path starts inside the rootmodelkey. -
formatLocation
Formats the location of the failure in the content, for exampleline 7, column 21, or returns an empty string when it is not known. -
reason
Explains the failure in one line. A class name that does not resolve is the expected case for an attribute'sjavaClass, and Jackson reports it only as the cause. -
sanitizeDefinition
-
sanitizeEntityDefinition
protected DynamicEntityDefinition sanitizeEntityDefinition(DynamicEntityDefinition entityDefinition)
-