Class DemoBase

  • Direct Known Subclasses:
    ExpressionDemo, ScriptDemo

    public class DemoBase
    extends java.lang.Object
    Common base class for the "...Demo" classes that demostrate Janino.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DemoBase()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object createObject​(java.lang.Class<?> type, java.lang.String value)
      Creates an instance of the given type, by calling the single-string-parameter constructor, or, if the value equals "", the zero-parameter constructor.
      static java.lang.String[] explode​(java.lang.String s)  
      static java.lang.Class<?> stringToType​(java.lang.String s)  
      static java.lang.Class<?>[] stringToTypes​(java.lang.String s)
      Converts the given comma-separated list of class names to an array of Classes.
      • Methods inherited from class java.lang.Object

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

      • DemoBase

        protected DemoBase()
    • Method Detail

      • createObject

        public static java.lang.Object createObject​(java.lang.Class<?> type,
                                                    java.lang.String value)
                                             throws java.lang.NoSuchMethodException,
                                                    java.lang.InstantiationException,
                                                    java.lang.reflect.InvocationTargetException,
                                                    java.lang.IllegalAccessException
        Creates an instance of the given type, by calling the single-string-parameter constructor, or, if the value equals "", the zero-parameter constructor.
        Throws:
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • explode

        public static java.lang.String[] explode​(java.lang.String s)
        Returns:
        s, split at the commas
      • stringToType

        public static java.lang.Class<?> stringToType​(java.lang.String s)
        Returns:
        s, converted to a Java type
      • stringToTypes

        public static java.lang.Class<?>[] stringToTypes​(java.lang.String s)
        Converts the given comma-separated list of class names to an array of Classes.