-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2a68a03
Showing
12 changed files
with
982 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('This would be the main JS file.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "Roaster", | ||
"tagline": "A Java Parser library that allows easy parsing and formatting of Java source files", | ||
"body": "Roaster - The only Java source parser library you'll ever need\r\n===============================================================\r\n\r\nRoaster (formerly known as java-parser) is a library that allows easy parsing and formatting of java source files. \r\nRoaster introduces a fluent interface to manipulate Java source files, like adding fields, methods, annotations and so on.\r\n\r\nInstallation\r\n============\r\n\r\n* If you are using Maven, add the following dependencies to your project: \r\n\r\n```xml\r\n<dependency>\r\n <groupId>org.jboss.forge.roaster</groupId>\r\n <artifactId>roaster-api</artifactId>\r\n <version>${version.roaster}</version>\r\n</dependency>\r\n<dependency>\r\n <groupId>org.jboss.forge.roaster</groupId>\r\n <artifactId>roaster-jdt</artifactId>\r\n <version>${version.roaster}</version>\r\n <scope>runtime</scope>\r\n</dependency>\r\n```\r\n\r\n* Otherwise, download and extract (or build from sources) the most recent [distribution](http://search.maven.org/#search|ga|1|a%3A%22roaster-distribution%22) containing the Roaster distribution and command line tools\r\n\r\nUsage\r\n=====\r\n\r\nCLI\r\n---\r\nExecute roaster by running the following script (add these to your $PATH for convenience):\r\n\r\n```\r\nbin/roaster (Unix/Linux/OSX)\r\nbin/roaster.bat (Windows)\r\n````\r\n\r\nOptions described here:\r\n\r\n```\r\n$ roaster -h\r\n\r\nUsage: roaster [OPTION]... FILES ... \r\nThe fastest way to build applications, share your software, and enjoy doing it. \r\n\r\n-c, --config [CONFIG_FILE]\r\n\t specify the path to the Eclipse code format profile (usually found at '$PROJECT/.settings/org.eclipse.jdt.core.prefs') \r\n\r\n-r, --recursive\r\n\t format files in found sub-directories recursively \r\n\r\nFILES... \r\n\t specify one or more space-separated files or directories to format \r\n\r\n-h, --help\r\n\t display this help and exit \r\n```\r\n\r\nJava Parser API\r\n---------------\r\n\r\nExample:\r\n```java\r\nRoaster.parse(JavaClassSource.class, \"public class HelloWorld {}\");\r\n```\r\n\r\nJava Source Code Generation API\r\n-------------------------------\r\n\r\nRoaster provides a fluent API to generate java classes. Here an example:\r\n\r\n```java\r\nfinal JavaClassSource javaClass = Roaster.create(JavaClassSource.class);\r\njavaClass.setPackage(\"com.company.example\").setName(\"Person\");\r\n\r\njavaClass.addInterface(Serializable.class);\r\njavaClass.addField()\r\n .setName(\"serialVersionUID\")\r\n .setType(\"long\")\r\n .setLiteralInitializer(\"1L\")\r\n .setPrivate()\r\n .setStatic(true)\r\n .setFinal(true);\r\n\r\njavaClass.addProperty(Integer.class, \"id\").setMutable(false);\r\njavaClass.addProperty(String.class, \"firstName\");\r\njavaClass.addProperty(\"String\", \"lastName\");\r\n\r\njavaClass.addMethod()\r\n .setConstructor(true)\r\n .setPublic()\r\n .setBody(\"this.id = id;\")\r\n .addParameter(Integer.class, \"id\");\r\n```\r\n\r\nWill produce:\r\n\r\n```java\r\npackage com.company.example;\r\n\r\nimport java.io.Serializable;\r\n\r\npublic class Person implements Serializable {\r\n\r\n private static final long serialVersionUID = 1L;\r\n private final Integer id;\r\n private String firstName;\r\n private String lastName;\r\n\r\n public Integer getId() {\r\n return id;\r\n }\r\n\r\n public String getFirstName() {\r\n return firstName;\r\n }\r\n\r\n public void setFirstName(String firstName) {\r\n this.firstName = firstName;\r\n }\r\n\r\n public String getLastName() {\r\n return lastName;\r\n }\r\n\r\n public void setLastName(String lastName) {\r\n this.lastName = lastName;\r\n }\r\n\r\n public Person(Integer id) {\r\n this.id = id;\r\n }\r\n}\r\n```\r\n\r\nJava Source Code Modification API\r\n---------------------------------\r\n\r\nOf course it is possible to mix both approaches (parser and writer) to modify Java code programmatically:\r\n\r\n```java\r\nJavaClassSource javaClass = \r\n Roaster.parse(JavaClassSource.class, \"public class SomeClass {}\");\r\njavaClass.addMethod()\r\n .setPublic()\r\n .setStatic(true)\r\n .setName(\"main\")\r\n .setReturnTypeVoid()\r\n .setBody(\"System.out.println(\\\"Hello World\\\");\")\r\n .addParameter(\"java.lang.String[]\", \"args\");\r\nSystem.out.println(javaClass);\r\n```\r\n\r\nJavaDoc creation and parsing\r\n----------------------------\r\n \r\nHere is an example on how to add JavaDoc to a class:\r\n\r\n```java\r\nJavaClassSource javaClass = \r\n Roaster.parse(JavaClassSource.class, \"public class SomeClass {}\");\r\nJavaDocSource javaDoc = javaClass.getJavaDoc();\r\n\r\njavaDoc.setFullText(\"Full class documentation\");\r\n// or \r\njavaDoc.setText(\"Class documentation text\");\r\njavaDoc.addTagValue(\"@author\",\"George Gastaldi\");\r\n\r\nSystem.out.println(javaClass);\r\n```\r\n\r\nFormatting the Java Source Code\r\n-------------------------------\r\n\r\nRoaster formats the Java Source Code by calling the format() method:\r\n\r\n```java\r\nString javaCode = \"public class MyClass{ private String field;}\";\r\nString formattedCode = Roaster.format(javaCode);\r\nSystem.out.println(formattedCode);\r\n```\r\n\r\nParsing the java unit \r\n----------------------\r\n\r\nThe link:http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.3[Java Language Specification] allows you to define multiple classes in the same .java file. Roaster supports parsing the entire unit by calling the parseUnit() method:\r\n\r\n```java\r\nString javaCode = \"public class MyClass{ private String field;} public class AnotherClass {}\";\r\n\r\nJavaUnit unit = Roaster.parseUnit(javaCode);\r\n\r\nJavaClassSource myClass = unit.getGoverningType();\r\nJavaClassSource anotherClass = (JavaClassSource) unit.getTopLevelTypes().get(1);\r\n```\r\n\r\nIssue tracker\r\n=============\r\n\r\n[ROASTER on JBossDeveloper](https://issues.jboss.org/browse/ROASTER). You might need to log in, in order to view the issues.\r\n\r\n\r\nGet in touch\r\n============\r\n\r\nRoaster uses the same forum and mailing lists as the [JBoss Forge](http://forge.jboss.org/) project. See the [JBoss Forge Community](http://forge.jboss.org/community) page.\r\n\r\n* [User forums](https://developer.jboss.org/en/forge)\r\n* [Developer forums](https://developer.jboss.org/en/forge/dev)\r\n\r\nLicense\r\n=======\r\n[Eclipse Public License - v 1.0](http://www.eclipse.org/legal/epl-v10.html)", | ||
"note": "Don't delete this file! It's used internally to help with page regeneration." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2016 GitHub, Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
.pl-c /* comment */ { | ||
color: #969896; | ||
} | ||
|
||
.pl-c1 /* constant, variable.other.constant, support, meta.property-name, support.constant, support.variable, meta.module-reference, markup.raw, meta.diff.header */, | ||
.pl-s .pl-v /* string variable */ { | ||
color: #0099cd; | ||
} | ||
|
||
.pl-e /* entity */, | ||
.pl-en /* entity.name */ { | ||
color: #9774cb; | ||
} | ||
|
||
.pl-smi /* variable.parameter.function, storage.modifier.package, storage.modifier.import, storage.type.java, variable.other */, | ||
.pl-s .pl-s1 /* string source */ { | ||
color: #ddd; | ||
} | ||
|
||
.pl-ent /* entity.name.tag */ { | ||
color: #7bcc72; | ||
} | ||
|
||
.pl-k /* keyword, storage, storage.type */ { | ||
color: #cc2372; | ||
} | ||
|
||
.pl-s /* string */, | ||
.pl-pds /* punctuation.definition.string, string.regexp.character-class */, | ||
.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, | ||
.pl-sr /* string.regexp */, | ||
.pl-sr .pl-cce /* string.regexp constant.character.escape */, | ||
.pl-sr .pl-sre /* string.regexp source.ruby.embedded */, | ||
.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */ { | ||
color: #3c66e2; | ||
} | ||
|
||
.pl-v /* variable */ { | ||
color: #fb8764; | ||
} | ||
|
||
.pl-id /* invalid.deprecated */ { | ||
color: #e63525; | ||
} | ||
|
||
.pl-ii /* invalid.illegal */ { | ||
color: #f8f8f8; | ||
background-color: #e63525; | ||
} | ||
|
||
.pl-sr .pl-cce /* string.regexp constant.character.escape */ { | ||
font-weight: bold; | ||
color: #7bcc72; | ||
} | ||
|
||
.pl-ml /* markup.list */ { | ||
color: #c26b2b; | ||
} | ||
|
||
.pl-mh /* markup.heading */, | ||
.pl-mh .pl-en /* markup.heading entity.name */, | ||
.pl-ms /* meta.separator */ { | ||
font-weight: bold; | ||
color: #264ec5; | ||
} | ||
|
||
.pl-mq /* markup.quote */ { | ||
color: #00acac; | ||
} | ||
|
||
.pl-mi /* markup.italic */ { | ||
font-style: italic; | ||
color: #ddd; | ||
} | ||
|
||
.pl-mb /* markup.bold */ { | ||
font-weight: bold; | ||
color: #ddd; | ||
} | ||
|
||
.pl-md /* markup.deleted, meta.diff.header.from-file */ { | ||
color: #bd2c00; | ||
background-color: #ffecec; | ||
} | ||
|
||
.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { | ||
color: #55a532; | ||
background-color: #eaffea; | ||
} | ||
|
||
.pl-mdr /* meta.diff.range */ { | ||
font-weight: bold; | ||
color: #9774cb; | ||
} | ||
|
||
.pl-mo /* meta.output */ { | ||
color: #264ec5; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
html, body, div, span, applet, object, iframe, | ||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
a, abbr, acronym, address, big, cite, code, | ||
del, dfn, em, img, ins, kbd, q, s, samp, | ||
small, strike, strong, sub, sup, tt, var, | ||
b, u, i, center, | ||
dl, dt, dd, ol, ul, li, | ||
fieldset, form, label, legend, | ||
table, caption, tbody, tfoot, thead, tr, th, td, | ||
article, aside, canvas, details, embed, | ||
figure, figcaption, footer, header, hgroup, | ||
menu, nav, output, ruby, section, summary, | ||
time, mark, audio, video { | ||
padding: 0; | ||
margin: 0; | ||
font: inherit; | ||
font-size: 100%; | ||
vertical-align: baseline; | ||
border: 0; | ||
} | ||
/* HTML5 display-role reset for older browsers */ | ||
article, aside, details, figcaption, figure, | ||
footer, header, hgroup, menu, nav, section { | ||
display: block; | ||
} | ||
body { | ||
line-height: 1; | ||
} | ||
ol, ul { | ||
list-style: none; | ||
} | ||
blockquote, q { | ||
quotes: none; | ||
} | ||
blockquote:before, blockquote:after, | ||
q:before, q:after { | ||
content: ''; | ||
content: none; | ||
} | ||
table { | ||
border-spacing: 0; | ||
border-collapse: collapse; | ||
} | ||
body { | ||
font-family: 'Helvetica Neue', Helvetica, Arial, serif; | ||
font-size: 13px; | ||
line-height: 1.5; | ||
color: #000; | ||
} | ||
|
||
a { | ||
font-weight: bold; | ||
color: #d5000d; | ||
} | ||
|
||
header { | ||
padding-top: 35px; | ||
padding-bottom: 10px; | ||
} | ||
|
||
header h1 { | ||
font-size: 48px; | ||
font-weight: bold; | ||
line-height: 1.2; | ||
color: #303030; | ||
letter-spacing: -1px; | ||
} | ||
|
||
header h2 { | ||
font-size: 24px; | ||
font-weight: normal; | ||
line-height: 1.3; | ||
color: #aaa; | ||
letter-spacing: -1px; | ||
} | ||
#downloads { | ||
display: none; | ||
} | ||
#main_content { | ||
padding-top: 20px; | ||
} | ||
|
||
code, pre { | ||
margin-bottom: 30px; | ||
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal; | ||
font-size: 12px; | ||
color: #222; | ||
} | ||
|
||
code { | ||
padding: 0 3px; | ||
} | ||
|
||
pre { | ||
padding: 20px; | ||
overflow: auto; | ||
border: solid 1px #ddd; | ||
} | ||
pre code { | ||
padding: 0; | ||
} | ||
|
||
ul, ol, dl { | ||
margin-bottom: 20px; | ||
} | ||
|
||
|
||
/* COMMON STYLES */ | ||
|
||
table { | ||
width: 100%; | ||
border: 1px solid #ebebeb; | ||
} | ||
|
||
th { | ||
font-weight: 500; | ||
} | ||
|
||
td { | ||
font-weight: 300; | ||
text-align: center; | ||
border: 1px solid #ebebeb; | ||
} | ||
|
||
form { | ||
padding: 20px; | ||
background: #f2f2f2; | ||
|
||
} | ||
|
||
|
||
/* GENERAL ELEMENT TYPE STYLES */ | ||
|
||
h1 { | ||
font-size: 2.8em; | ||
} | ||
|
||
h2 { | ||
margin-bottom: 8px; | ||
font-size: 22px; | ||
font-weight: bold; | ||
color: #303030; | ||
} | ||
|
||
h3 { | ||
margin-bottom: 8px; | ||
font-size: 18px; | ||
font-weight: bold; | ||
color: #d5000d; | ||
} | ||
|
||
h4 { | ||
font-size: 16px; | ||
font-weight: bold; | ||
color: #303030; | ||
} | ||
|
||
h5 { | ||
font-size: 1em; | ||
color: #303030; | ||
} | ||
|
||
h6 { | ||
font-size: .8em; | ||
color: #303030; | ||
} | ||
|
||
p { | ||
margin-bottom: 20px; | ||
font-weight: 300; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
} | ||
|
||
p a { | ||
font-weight: 400; | ||
} | ||
|
||
blockquote { | ||
padding: 0 0 0 30px; | ||
margin-bottom: 20px; | ||
font-size: 1.6em; | ||
border-left: 10px solid #e9e9e9; | ||
} | ||
|
||
ul li { | ||
list-style-position: inside; | ||
list-style: disc; | ||
padding-left: 20px; | ||
} | ||
|
||
ol li { | ||
list-style-position: inside; | ||
list-style: decimal; | ||
padding-left: 3px; | ||
} | ||
|
||
dl dd { | ||
font-style: italic; | ||
font-weight: 100; | ||
} | ||
|
||
footer { | ||
padding-top: 20px; | ||
padding-bottom: 30px; | ||
margin-top: 40px; | ||
font-size: 13px; | ||
color: #aaa; | ||
} | ||
|
||
footer a { | ||
color: #666; | ||
} | ||
|
||
/* MISC */ | ||
.clearfix:after { | ||
display: block; | ||
height: 0; | ||
clear: both; | ||
visibility: hidden; | ||
content: '.'; | ||
} | ||
|
||
.clearfix {display: inline-block;} | ||
* html .clearfix {height: 1%;} | ||
.clearfix {display: block;} |
Oops, something went wrong.