Package io.micronaut.views
Class ViewUtils
java.lang.Object
io.micronaut.views.ViewUtils
Utility methods for views.
- Since:
- 1.1.0
- Author:
- James Kleeh
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a view model for the given data.static @NonNull String
normalizeFile
(@NonNull String path, String extension) Returns a path that is converted to unix style file separators and never starts with a "/".static @NonNull String
normalizeFolder
(@Nullable String path) Returns a path with unix style folder separators that starts and ends with a "/".
-
Field Details
-
EXTENSION_SEPARATOR
Extension separator.- See Also:
-
-
Constructor Details
-
ViewUtils
public ViewUtils()
-
-
Method Details
-
modelOf
Creates a view model for the given data.- Parameters:
data
- The data- Returns:
- The model
-
normalizeFolder
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 normalizeFileextension
- The file extension- Returns:
- The normalized path
-