Class RecipeFinder


  • public class RecipeFinder
    extends Object
    This class define a finder for recipe files.
    Since:
    3.0
    Author:
    Laurent Jourdren
    • Constructor Detail

      • RecipeFinder

        public RecipeFinder​(Path directory)
                     throws Aozan3Exception
        Constructor.
        Parameters:
        directory - path of the recipe directory
        Throws:
        Aozan3Exception - if the path is not an existing directory
    • Method Detail

      • getRecipeName

        public static String getRecipeName​(Path file)
        Load a file and try to get the recipe name inside if it is a recipe file.
        Parameters:
        file - the file to load
        Returns:
        the name of the recipe in a String or null if the file is not a recipe file
      • isRecipe

        public static boolean isRecipe​(List<RecipeFinder.RecipePath> recipes,
                                       String recipeName)
        Test if a recipe exists in a list of recipes.
        Parameters:
        recipes - recipe list
        recipeName - name of the recipe
        Returns:
        true if the recipe exists
      • isRecipeUnique

        public static boolean isRecipeUnique​(List<RecipeFinder.RecipePath> recipes,
                                             String recipeName)
        Test if a recipe is unique in a list of recipes.
        Parameters:
        recipes - recipe list
        recipeName - name of the recipe
        Returns:
        true if the recipe is unique
      • getRecipePath

        public static Path getRecipePath​(List<RecipeFinder.RecipePath> recipes,
                                         String recipeName)
        Get the path of a recipe in a list of recipes.
        Parameters:
        recipes - recipe list
        recipeName - name of the recipe
        Returns:
        true if the recipe exists