Package org.codehaus.commons.compiler.samples

# Class DemoBase

java.lang.Object
org.codehaus.commons.compiler.samples.DemoBase

Direct Known Subclasses:
  `ExpressionDemo`, `ScriptDemo`

public class DemoBase extends Object
Common base class for the "...Demo" classes that demostrate Janino.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`DemoBase()`

## Method Summary

Modifier and Type
Method
Description
`static Object`
`createObject(Class<?> type, 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 String[]`
`explode(String s)`
`static Class<?>`
`stringToType(String s)`
`static Class<?>[]`
`stringToTypes(String s)`
Converts the given comma-separated list of class names to an array of `Class`es.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DemoBase

protected DemoBase()

## Method Details

### createObject

public static Object createObject(Class<?> type, String value) throws NoSuchMethodException, InstantiationException, InvocationTargetException, 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:
  `NoSuchMethodException`
  `InstantiationException`
  `InvocationTargetException`
  `IllegalAccessException`

### explode

public static String[] explode(String s)

Returns:
  s, split at the commas

### stringToType

public static Class<?> stringToType(String s)

Returns:
  s, converted to a Java type

### stringToTypes

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