mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java
<ViewModelType extends ViewModel> void injectResourceBundle(View<? extends ViewModelType> view,
            ResourceBundle resourceBundle) {
        try {
            Field resourcesField = view.getClass().getField(NAMING_CONVENTION_RESOURCES_IDENTIFIER);

            if (resourcesField.getType().isAssignableFrom(ResourceBundle.class)) {
                resourcesField.set(view, resourceBundle);
            }
        } catch (NoSuchFieldException e) {
            // This exception means that there is no field for the
            // ResourceBundle.
            // This is no exceptional case but is normal when you don't need a
            // resourceBundle in a specific view.
            // Therefore it's save to silently catch the exception.
        } catch (IllegalAccessException e) {
            LOG.warn("Can't inject the ResourceBundle into the view {} because the field isn't accessible", view);
        }

    }
<ViewModelType extends ViewModel> void injectResourceBundle(View<? extends ViewModelType> view,
            ResourceBundle resourceBundle) {
        try {
            Field resourcesField = view.getClass().getField(NAMING_CONVENTION_RESOURCES_IDENTIFIER);

            if (resourcesField.getType().isAssignableFrom(ResourceBundle.class)) {
                resourcesField.set(view, resourceBundle);
            }
        } catch (NoSuchFieldException e) {
            // This exception means that there is no field for the
            // ResourceBundle.
            // This is no exceptional case but is normal when you don't need a
            // resourceBundle in a specific view.
            // Therefore it's save to silently catch the exception.
        } catch (IllegalAccessException e) {
            LOG.warn("Can't inject the ResourceBundle into the view {} because the field isn't accessible", view);
        }

    }
< ViewModelType extends ViewModel > void injectResourceBundle ( View < ? extends ViewModelType > view , ResourceBundle resourceBundle ) { try { Field resourcesField = view . getClass ( ) . getField ( NAMING_CONVENTION_RESOURCES_IDENTIFIER ) ; if ( resourcesField . getType ( ) . isAssignableFrom ( ResourceBundle . class ) ) { resourcesField . set ( view , resourceBundle ) ; } } catch ( NoSuchFieldException e ) { // This exception means that there is no field for the // ResourceBundle. // This is no exceptional case but is normal when you don't need a // resourceBundle in a specific view. // Therefore it's save to silently catch the exception. } catch ( IllegalAccessException e ) { LOG . warn ( "Can't inject the ResourceBundle into the view {} because the field isn't accessible" , view ) ; } }
Injects the given ResourceBundle into the given view using reflection.
This is done to meet the conventions of the
{@link javafx.fxml.FXMLLoader}. The resourceBundle is only injected when
there is a <strong>public</strong> field of the type
{@link java.util.ResourceBundle} named "resources". <br>
This method is package scoped for better testability.

@param view
the view instance that gets the resourceBundle injected.
@param resourceBundle
the resourceBundle instance that will be injected.
@param <ViewModelType>
the generic type of the view.
Injects the given ResourceBundle into the given view using reflection . This is done to meet the conventions of the { @link javafx . fxml . FXMLLoader } . The resourceBundle is only injected when there is a <strong > public< / strong > field of the type { @link java . util . ResourceBundle } named resources . <br > This method is package scoped for better testability .