Interface Solution<T extends Issue>

    • Method Detail

      • isPreferred

        default boolean isPreferred()
        Indicates to the user whether this solution is a preferred solution, i.e. will most likely lead to the desired, correct result. Preferred solutions may be specially marked in the UI by the application.
        Returns:
        true, if this is a preferred solution.
      • getDescription

        String getDescription()
        Description of this solution. You may use HTML, but no enclosing <html> tags. E.g.:
        My <em>super</em> solution.
        Returns:
        description
        See Also:
        getClassDescription()
      • getId

        String getId()
        Unique id for this solution instance. May be used in hyperlinks.
        Returns:
        unique id for this issue, which can be used in hyperlinks
        See Also:
        getClassId()
      • getClassDescription

        default String getClassDescription()
        Returns a common description for this class of solution. This is used when the same kind (or class) of solution should be used for a collection of issues. In other words, the user selects multiple issues and wants them all solved in the same way. This implies, that there cannot be any user interaction.
        If this solution does not make any sense as a class solution, this method must return null.
        Returns:
        description contains description for a whole collection of issues, not an individual one or null, if this solution cannot be applied to multiple issues at once (because it is too specific for a given issue)
        See Also:
        getDescription(), getClassId()
      • getClassId

        default String getClassId()
        Id for a class of solutions. If this solutions cannot be applied for multiple issues at once, this method must return null.
        Returns:
        id for this solution's class - typically unique per solutions class. Default value (if used) should be the actual class name, i.e. solution.getClass().getName()
        See Also:
        getClassDescription()
      • getIssue

        T getIssue()
        Return issue this is a solution to.
        Returns:
        issue this is a solution to
      • createCallable

        CallableSolution createCallable​(Collection<AudioSong> selectedSongs,
                                        boolean allowUserInteraction)

        Creates a CallableSolution that may be called later to actually apply this solution. You may return null to signal, that the callable could not be created, perhaps because the user cancelled some interaction.

        This method is typically called on the EDT to allow potential user interaction, so it must execute quickly.

        Parameters:
        selectedSongs - songs this solution should be applied to, i.e. the songs the user selected in the UI
        allowUserInteraction - if set to true the solution may show a dialog asking for confirmation or some other form of visual user interaction. If set to false, the solution has to be applied silently.
        Returns:
        a callable, if the problem can be solved, null, if the user cancelled or some other problem occurred