public final class Roaster extends Object
JavaType instances.| Modifier and Type | Method and Description |
|---|---|
static <T extends JavaSource<?>> |
create(Class<T> type)
Create a new empty
JavaSource instance. |
static String |
format(Properties properties,
String source)
Format the given
String as a Java source type, using the given code format Properties |
static String |
format(String source)
Format the given
String as a Java source file, using the built in code format style. |
static JavaType<?> |
parse(char[] data)
Parse the given character array into a new
JavaType instance. |
static <T extends JavaType<?>> |
parse(Class<T> type,
char[] data)
Read the given character array and parse its data into a new
JavaType instance of the given type. |
static <T extends JavaType<?>> |
parse(Class<T> type,
File file)
|
static <T extends JavaType<?>> |
parse(Class<T> type,
InputStream stream)
Read the given
InputStream and parse its data into a new JavaType instance of the given type. |
static <T extends JavaType<?>> |
parse(Class<T> type,
String data)
Read the given string and parse its data into a new
JavaType instance of the given type. |
static <T extends JavaType<?>> |
parse(Class<T> type,
URL url)
|
static JavaType<?> |
parse(File file)
|
static JavaType<?> |
parse(InputStream stream)
Read the given
InputStream and parse the data into a new JavaType instance. |
static JavaType<?> |
parse(String data)
Parse the given String data into a new
JavaType instance. |
static JavaType<?> |
parse(URL url)
|
static JavaUnit |
parseUnit(InputStream data)
Read the given
InputStream and parse its data into a new JavaUnit instance of the given type. |
static JavaUnit |
parseUnit(String data)
|
static List<Problem> |
validateSnippet(String snippet)
|
public static <T extends JavaSource<?>> T create(Class<T> type)
JavaSource instance.T - the java typetype - the type of the sourceJavaType instance of the given typeIllegalStateException - if no parser is available in the classPathParserException - if no parser is capable of parsing the provided datapublic static JavaType<?> parse(File file) throws IOException
file - the file to read fromJavaType instanceIOException - if the reading of the file failsParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static JavaType<?> parse(URL url) throws IOException
url - the url to read fromJavaType instanceIOException - if the reading failsParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static JavaType<?> parse(InputStream stream)
InputStream and parse the data into a new JavaType instance. The caller is
responsible to close the stream.stream - the stream to read fromJavaType instanceParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static JavaType<?> parse(char[] data)
JavaType instance.data - the characters to parseJavaType instanceParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static JavaType<?> parse(String data)
JavaType instance.data - the data to parseJavaType instanceParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static <T extends JavaType<?>> T parse(Class<T> type, URL url) throws IOException
T - the java typetype - the type of the sourceurl - the url to read fromJavaType instance of the given typeIOException - if a exception occurs while readingParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static <T extends JavaType<?>> T parse(Class<T> type, File file) throws FileNotFoundException, IOException
T - the java typetype - the type of the sourcefile - the file to read fromJavaType instance of the given typeIOException - if a exception occurs while readingFileNotFoundException - if the file doesn't existsParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static <T extends JavaType<?>> T parse(Class<T> type, char[] data)
JavaType instance of the given type.T - the java typetype - the type of the sourcedata - the characters to parseJavaType instance of the given typeParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static List<Problem> validateSnippet(String snippet) throws ParserException
snippet - any Java codeParserException - if no JavaParser implementation could be foundpublic static <T extends JavaType<?>> T parse(Class<T> type, String data)
JavaType instance of the given type.T - the java typetype - the type of the sourcedata - the data to parseJavaType instance of the given typeParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static <T extends JavaType<?>> T parse(Class<T> type, InputStream stream)
InputStream and parse its data into a new JavaType instance of the given type. The
caller is responsible for closing the stream.T - the java typestream - the stream to read fromtype - the type of the sourceJavaType instance of the given typeParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static JavaUnit parseUnit(String data)
data - the data to parseJavaUnit instance of the given typeParserException - if no parser is capable of parsing the requested dataIllegalStateException - if no parser is available in the classPathpublic static JavaUnit parseUnit(InputStream data)
InputStream and parse its data into a new JavaUnit instance of the given type. The
caller is responsible for closing the stream.data - the stream to read fromJavaUnit instance of the given typeParserException - if no parser is capable of parsing the provided dataIllegalStateException - if no parser is available in the classPathpublic static String format(String source)
String as a Java source file, using the built in code format style.source - a java source codeIllegalStateException - if no formatter is available in the classPathpublic static String format(Properties properties, String source)
String as a Java source type, using the given code format Propertiesproperties - the properties to use to formatsource - a java source codeIllegalStateException - if no formatter is available in the classPathCopyright © 2019 JBoss by Red Hat. All rights reserved.