Class ViewUtils

java.lang.Object
io.micronaut.views.ViewUtils

public class ViewUtils extends Object
Utility methods for views.
Since:
1.1.0
Author:
James Kleeh
  • Field Details

  • Constructor Details

    • ViewUtils

      public ViewUtils()
  • Method Details

    • modelOf

      @NonNull public static @NonNull Map<String,Object> modelOf(@Nullable @Nullable Object data)
      Creates a view model for the given data.
      Parameters:
      data - The data
      Returns:
      The model
    • normalizeFolder

      @NonNull public static @NonNull String normalizeFolder(@Nullable @Nullable String path)
      Returns a path with unix style folder separators that starts and ends with a "/".
      Parameters:
      path - The path to normalizeFile
      Returns:
      The normalized path
    • normalizeFile

      @NonNull public static @NonNull String normalizeFile(@NonNull @NonNull String path, String extension)
      Returns a path that is converted to unix style file separators and never starts with a "/". If an extension is provided and the path ends with the extension, the extension will be stripped. The extension parameter supports extensions that do and do not begin with a ".".
      Parameters:
      path - The path to normalizeFile
      extension - The file extension
      Returns:
      The normalized path