Class MetaschemaJsonWriter

    • Constructor Detail

      • MetaschemaJsonWriter

        public MetaschemaJsonWriter​(@NonNull
                                    com.fasterxml.jackson.core.JsonGenerator generator)
        Construct a new Module-aware JSON writer.
        Parameters:
        generator - the JSON generator to write with
        See Also:
        DefaultJsonProblemHandler
    • Method Detail

      • getWriter

        public com.fasterxml.jackson.core.JsonGenerator getWriter()
        Description copied from interface: IWritingContext
        Get the writer associated with the writing context.
        Specified by:
        getWriter in interface IWritingContext<com.fasterxml.jackson.core.JsonGenerator>
        Returns:
        the writer
      • write

        public void write​(@NonNull
                          IAssemblyClassBinding targetDefinition,
                          @NonNull
                          Object targetObject)
                   throws IOException
        Writes data in a bound object to JSON. This assembly must be a root assembly for which a call to IAssemblyDefinition.isRoot() will return true.
        Parameters:
        targetDefinition - the definition describing the root element data to write
        targetObject - the bound object
        Throws:
        IOException - if an error occurred while reading the JSON
      • writeInstance

        protected void writeInstance​(@NonNull
                                     IBoundNamedInstance targetInstance,
                                     @NonNull
                                     Object parentObject)
                              throws IOException
        Write the instance data contained in the parentObject based on the structure described by the targetInstance.
        Parameters:
        targetInstance - the instance to write data for
        parentObject - the Java object containing the instance data to write
        Throws:
        IOException - if an error occurred while writing the data
      • writeFlagInstanceValue

        protected void writeFlagInstanceValue​(@NonNull
                                              IBoundFlagInstance targetInstance,
                                              @NonNull
                                              Object parentObject)
                                       throws IOException
        Write the instance data contained in the parentObject based on the structure described by the targetInstance.
        Parameters:
        targetInstance - the instance to write data for
        parentObject - the Java object containing the instance data to write
        Throws:
        IOException - if an error occurred while writing the data
      • writeModelInstanceValues

        protected void writeModelInstanceValues​(@NonNull
                                                IBoundNamedModelInstance targetInstance,
                                                @NonNull
                                                Object parentObject)
                                         throws IOException
        Write the instance data contained in the parentObject based on the structure described by the targetInstance.
        Parameters:
        targetInstance - the instance to write data for
        parentObject - the Java object containing the instance data to write
        Throws:
        IOException - if an error occurred while writing the data
      • writeFieldValueInstanceValue

        protected void writeFieldValueInstanceValue​(@NonNull
                                                    IBoundFieldValueInstance targetInstance,
                                                    @NonNull
                                                    Object parentObject)
                                             throws IOException
        Write the instance data contained in the parentObject based on the structure described by the targetInstance.
        Parameters:
        targetInstance - the instance to write data for
        parentObject - the Java object containing the instance data to write
        Throws:
        IOException - if an error occurred while writing the data