Class DynClasses.Builder

  • Enclosing class:
    DynClasses

    public static class DynClasses.Builder
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <S> java.lang.Class<? extends S> build()
      Returns the first implementation or throws RuntimeException if one was not found.
      <S> java.lang.Class<? extends S> buildChecked()
      Returns the first implementation or throws ClassNotFoundException if one was not found.
      DynClasses.Builder impl​(java.lang.String className)
      Checks for an implementation of the class by name.
      DynClasses.Builder loader​(java.lang.ClassLoader newLoader)
      Set the ClassLoader used to lookup classes by name.
      DynClasses.Builder orNull()
      Instructs this builder to return null if no class is found, rather than throwing an Exception.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • loader

        public DynClasses.Builder loader​(java.lang.ClassLoader newLoader)
        Set the ClassLoader used to lookup classes by name.

        If not set, the current thread's ClassLoader is used.

        Parameters:
        newLoader - a ClassLoader
        Returns:
        this Builder for method chaining
      • impl

        public DynClasses.Builder impl​(java.lang.String className)
        Checks for an implementation of the class by name.
        Parameters:
        className - name of a class
        Returns:
        this Builder for method chaining
      • orNull

        public DynClasses.Builder orNull()
        Instructs this builder to return null if no class is found, rather than throwing an Exception.
        Returns:
        this Builder for method chaining
      • buildChecked

        public <S> java.lang.Class<? extends S> buildChecked()
                                                      throws java.lang.ClassNotFoundException
        Returns the first implementation or throws ClassNotFoundException if one was not found.
        Type Parameters:
        S - Java superclass
        Returns:
        a Class for the first implementation found
        Throws:
        java.lang.ClassNotFoundException - if no implementation was found
      • build

        public <S> java.lang.Class<? extends S> build()
        Returns the first implementation or throws RuntimeException if one was not found.
        Type Parameters:
        S - Java superclass
        Returns:
        a Class for the first implementation found
        Throws:
        java.lang.RuntimeException - if no implementation was found