mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java
private String createFxmlPath(Class<?> viewType) {
        final StringBuilder pathBuilder = new StringBuilder();

        final FxmlPath pathAnnotation = viewType.getDeclaredAnnotation(FxmlPath.class); //Get annotation from view
        final String fxmlPath = Optional.ofNullable(pathAnnotation)
                .map(FxmlPath::value)
                .map(String::trim)
                .orElse("");

        if (fxmlPath.isEmpty()) {
            pathBuilder.append("/");

            if (viewType.getPackage() != null) {
                pathBuilder.append(viewType.getPackage().getName().replaceAll("\\.", "/"));
                pathBuilder.append("/");
            }

            pathBuilder.append(viewType.getSimpleName());
            pathBuilder.append(".fxml");
        } else {
            pathBuilder.append(fxmlPath);
        }

        return pathBuilder.toString();
    }
private String createFxmlPath(Class<?> viewType) {
        final StringBuilder pathBuilder = new StringBuilder();

        final FxmlPath pathAnnotation = viewType.getDeclaredAnnotation(FxmlPath.class); //Get annotation from view
        final String fxmlPath = Optional.ofNullable(pathAnnotation)
                .map(FxmlPath::value)
                .map(String::trim)
                .orElse("");

        if (fxmlPath.isEmpty()) {
            pathBuilder.append("/");

            if (viewType.getPackage() != null) {
                pathBuilder.append(viewType.getPackage().getName().replaceAll("\\.", "/"));
                pathBuilder.append("/");
            }

            pathBuilder.append(viewType.getSimpleName());
            pathBuilder.append(".fxml");
        } else {
            pathBuilder.append(fxmlPath);
        }

        return pathBuilder.toString();
    }
private String createFxmlPath ( Class < ? > viewType ) { final StringBuilder pathBuilder = new StringBuilder ( ) ; final FxmlPath pathAnnotation = viewType . getDeclaredAnnotation ( FxmlPath . class ) ; //Get annotation from view final String fxmlPath = Optional . ofNullable ( pathAnnotation ) . map ( FxmlPath :: value ) . map ( String :: trim ) . orElse ( "" ) ; if ( fxmlPath . isEmpty ( ) ) { pathBuilder . append ( "/" ) ; if ( viewType . getPackage ( ) != null ) { pathBuilder . append ( viewType . getPackage ( ) . getName ( ) . replaceAll ( "\\." , "/" ) ) ; pathBuilder . append ( "/" ) ; } pathBuilder . append ( viewType . getSimpleName ( ) ) ; pathBuilder . append ( ".fxml" ) ; } else { pathBuilder . append ( fxmlPath ) ; } return pathBuilder . toString ( ) ; }
This method is used to create a String with the path to the FXML file for
a given View class.

This is done by taking the package of the view class (if any) and replace
"." with "/". After that the Name of the class and the file ending
".fxml" is appended.

If the View class is annotated with @FxmlPath then the String path supplied
in the annotation  value will be used.

Example: de.saxsys.myapp.ui.MainView as view class will be transformed to
"/de/saxsys/myapp/ui/MainView.fxml"

Example 2: MainView (located in the default package) will be transformed
to "/MainView.fxml"

@param viewType
the view class type.
@return the path to the fxml file as string.
This method is used to create a String with the path to the FXML file for a given View class .