Class AllowedPackageChecker

java.lang.Object
com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker

public class AllowedPackageChecker extends Object
Utilities for checking if a component's package is allowed.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Component>
    void
    check(T component, Class<? super T> type)
    Checks that the component's package is allowed and displays an error message if the package name is not in the list.
    static <T extends Component>
    void
    check(T component, Class<? super T> type, String packageName)
    Checks that the component's package is allowed and displays an error message if the package name is not in the list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • check

      public static <T extends Component> void check(T component, Class<? super T> type)
      Checks that the component's package is allowed and displays an error message if the package name is not in the list.

      The check is performed only in development mode for Spring Boot applications that have an allowed packages list. No check is done in production mode.

      Parameters:
      component - the component instance to be checked.
      type - the type of the component to be checked.
    • check

      public static <T extends Component> void check(T component, Class<? super T> type, String packageName)
      Checks that the component's package is allowed and displays an error message if the package name is not in the list.

      The check is performed only in development mode for Spring Boot applications that have an allowed packages list. No check is done in production mode.

      The error message will reference packageName.

      Parameters:
      component - the component instance to be checked.
      type - the type of the component to be checked.
      packageName - the package to report in the error message.
      Throws:
      NullPointerException - if any argument is null.
      IllegalArgumentException - if the component's package does not match or is not a subpackage of packageName.