Class AbstractProblemHandler

    • Method Detail

      • handleMissingInstances

        public void handleMissingInstances​(IClassBinding parentDefinition,
                                           Object targetObject,
                                           Collection<? extends IBoundNamedInstance> unhandledInstances)
                                    throws IOException
        Description copied from interface: IProblemHandler
        A callback used to handle bound properties for which no data was found when the content was parsed.

        This can be used to supply default or prescribed values based on application logic.

        Specified by:
        handleMissingInstances in interface IProblemHandler
        Parameters:
        parentDefinition - the bound class on which the missing properties are found
        targetObject - the Java object for the parentDefinition
        unhandledInstances - the set of instances that had no data to parse
        Throws:
        IOException - if an error occurred while handling the missing instances
      • applyDefaults

        protected static <TYPE extends IBoundNamedInstance> void applyDefaults​(@NonNull
                                                                               Object targetObject,
                                                                               @NonNull
                                                                               Collection<TYPE> unhandledInstances)
                                                                        throws IOException
        A utility method for applying default values for the provided unhandledInstances.
        Type Parameters:
        TYPE - the instance Java type to handle
        Parameters:
        targetObject - the Java object to apply default values to
        unhandledInstances - the collection of unhandled instances to assign default values for
        Throws:
        IOException - if an error occurred while determining the default value for an instance