-
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.
ROASTER-1: Java Statement Fluent Model
Update Copyright Conflicts: api/src/main/java/org/jboss/forge/roaster/model/source/MethodSource.java impl/src/main/java/org/jboss/forge/roaster/model/impl/AnnotationImpl.java impl/src/main/java/org/jboss/forge/roaster/model/impl/MethodImpl.java Conflicts: impl/src/main/java/org/jboss/forge/roaster/model/impl/MethodImpl.java
- Loading branch information
Showing
177 changed files
with
13,808 additions
and
23 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
api/src/main/java/org/jboss/forge/roaster/model/Block.java
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,21 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model; | ||
|
||
import org.jboss.forge.roaster.Origin; | ||
import org.jboss.forge.roaster.model.source.BlockHolder; | ||
|
||
/** | ||
* Represent a block, a sequence of statements possibly including other blocks | ||
*/ | ||
public interface Block<O extends JavaType<O>, | ||
P extends BlockHolder<O>> | ||
extends Origin<P>, | ||
BlockHolder<O> { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
api/src/main/java/org/jboss/forge/roaster/model/ExpressionHolder.java
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,12 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model; | ||
|
||
public interface ExpressionHolder<O extends JavaType<O>> { | ||
|
||
} |
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
87 changes: 87 additions & 0 deletions
87
api/src/main/java/org/jboss/forge/roaster/model/expressions/AccessBuilder.java
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,87 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
/** | ||
* Abstract factory interface that supports the construction of accessor expressions, in source format | ||
* The expression returns an object with accessible fields, accessors and methods | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface AccessBuilder<O extends JavaSource<O>, | ||
P extends ExpressionHolder<O>, | ||
E extends NonPrimitiveExpression<O,P,E>> | ||
{ | ||
|
||
/** | ||
* Returns a field access expression | ||
* Can be invoked on a parent expression | ||
* @param field The name of the field | ||
* @return a field accessor | ||
*/ | ||
public Field<O,E> field(String field); | ||
|
||
/** | ||
* Returns a getter expression | ||
* Can be invoked on a parent expression | ||
* @param field The name of the field | ||
* @param klass The name of the type of the field | ||
* @return a getter method invocation expression | ||
*/ | ||
public Getter<O,E> getter(String field, String klass); | ||
|
||
/** | ||
* Returns a getter expression | ||
* Can be invoked on a parent expression | ||
* @param field The name of the field | ||
* @param klass The type of the field | ||
* @return a getter method invocation expression | ||
*/ | ||
public Getter<O,E> getter(String field, Class klass); | ||
|
||
/** | ||
* Returns a setter expression | ||
* Can be invoked on a parent expression | ||
* @param field The name of the field | ||
* @param klass The name of the type of the field | ||
* @param value The expression returning the value to be set | ||
* @return a setter method invocation expression | ||
*/ | ||
public Setter<O,E> setter(String field, String klass, ExpressionSource<?,?,?> value); | ||
|
||
/** | ||
* Returns a setter expression | ||
* Can be invoked on a parent expression | ||
* @param field The name of the field | ||
* @param klass The type of the field | ||
* @param value The expression returning the value to be set | ||
* @return a setter method invocation expression | ||
*/ | ||
public Setter<O,E> setter(String field, Class klass, ExpressionSource<?,?,?> value); | ||
|
||
/** | ||
* Returns a method invocation expression | ||
* Can be invoked on a parent expression | ||
* @param method The name of the method | ||
* @return a method invocation expression | ||
*/ | ||
public MethodCallExpression<O,E> invoke(String method); | ||
|
||
/** | ||
* Returns an array indexing expression | ||
* Can be invoked on a parent expression | ||
* @param index The expression returning the index used for accessing the array | ||
* @return an array indexing expression | ||
*/ | ||
public ArrayIndexer<O,E> itemAt(ExpressionSource<?,?,?> index); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
api/src/main/java/org/jboss/forge/roaster/model/expressions/Accessor.java
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,25 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
/** | ||
* Abstract interface that represents accessors (getters, fields, etc..) in source format | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface Accessor<O extends JavaSource<O>, | ||
P extends ExpressionHolder<O>, | ||
E extends NonPrimitiveExpression<O,P,E>> | ||
extends Argument<O,P,E>, | ||
AccessBuilder<O,P,E> | ||
{ | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
api/src/main/java/org/jboss/forge/roaster/model/expressions/Argument.java
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,25 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
/** | ||
* Abstract marker interface that represents operation or method arguments in source format | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface Argument<O extends JavaSource<O>, | ||
P extends ExpressionHolder<O>, | ||
E extends ExpressionSource<O,P,E>> | ||
extends ExpressionSource<O,P,E> | ||
{ | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
api/src/main/java/org/jboss/forge/roaster/model/expressions/ArgumentHolder.java
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,38 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Abstract marker interface that represents expressions requiring arguments | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface ArgumentHolder<O extends JavaSource<O>, | ||
P extends ExpressionHolder<O>, | ||
E extends NonPrimitiveExpression<O,P,?>> | ||
extends ExpressionHolder<O> | ||
{ | ||
|
||
/** | ||
* Adds an argument to the expression | ||
* @param arg The argument to be added | ||
* @return The expression itself | ||
*/ | ||
public E addArgument(Argument<?,?,?> arg); | ||
|
||
/** | ||
* Returns the current list of arguments | ||
* @return An immutable list containing the arguments | ||
*/ | ||
public List<Argument<O,E,?>> getArguments(); | ||
} |
57 changes: 57 additions & 0 deletions
57
api/src/main/java/org/jboss/forge/roaster/model/expressions/ArrayConstructorExpression.java
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,57 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represent an array constructor expression in source format | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface ArrayConstructorExpression<O extends JavaSource<O>, | ||
P extends ExpressionHolder<O>> | ||
extends Argument<O,P,ArrayConstructorExpression<O,P>>, | ||
NonPrimitiveExpression<O,P,ArrayConstructorExpression<O,P>> | ||
{ | ||
|
||
/** | ||
* Adds a dimension to the array, allocating <code>dim</code> slots | ||
* @param dim the number of elements in the new array dimension | ||
* @return The <code>ArrayConstructorExpression/code> itself | ||
*/ | ||
public ArrayConstructorExpression<O,P> addDimension(ExpressionSource<?,?,?> dim); | ||
|
||
/** | ||
* Initializes the array using an <code>ArrayInit</code> expressoin | ||
* @param array the initial value for the array variable | ||
* @return The <code>ArrayConstructorExpression/code> itself | ||
*/ | ||
public ArrayConstructorExpression<O,P> init(ArrayInit<?,?> array); | ||
|
||
/** | ||
* Returns the array initialization expression, or null if none has been set | ||
* @return An <code>ArrayInit</code> expression | ||
*/ | ||
public ArrayInit<O,ArrayConstructorExpression<O,P>> getInit(); | ||
|
||
/** | ||
* Returns the expressions defining the number of slots for each array dimension | ||
* @return An immutable list containing the expressions initializing each dimension | ||
*/ | ||
public List<ExpressionSource<O,ArrayConstructorExpression<O,P>,?>> getDimensions(); | ||
|
||
/** | ||
* Returns the number of dimensions of the array being constructed | ||
* @return the number of dimensions for this array | ||
*/ | ||
public int getDimension(); | ||
} |
37 changes: 37 additions & 0 deletions
37
api/src/main/java/org/jboss/forge/roaster/model/expressions/ArrayIndexer.java
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,37 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
/** | ||
* Represent an array indexing expression in source format | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface ArrayIndexer<O extends JavaSource<O>, P extends ExpressionHolder<O>> | ||
extends OrdinalArgument<O,P,ArrayIndexer<O,P>>, | ||
NonPrimitiveExpression<O,P,ArrayIndexer<O,P>>, | ||
InvocationTargetHolder<O,P,ArrayIndexer<O,P>> | ||
{ | ||
|
||
/** | ||
* Returns the expression returning the index to be accessed | ||
* @return The expression returning the index used by this <code>ArrayIndexer</code> | ||
*/ | ||
public ExpressionSource<O,ArrayIndexer<O,P>,?> getIndex(); | ||
|
||
/** | ||
* Sets the expression returning the index to be used for accessing the array | ||
* @param index An expression returning an integer, used to access the array | ||
* @return The <code>ArrayIndexer</code> itself | ||
*/ | ||
public ArrayIndexer<O,P> setIndex(ExpressionSource<?,?,?> index); | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
api/src/main/java/org/jboss/forge/roaster/model/expressions/ArrayInit.java
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,59 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.roaster.model.expressions; | ||
|
||
|
||
import org.jboss.forge.roaster.model.ExpressionHolder; | ||
import org.jboss.forge.roaster.model.source.JavaSource; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represent an array constructor expression in source format | ||
* | ||
* @author <a href="dsotty@gmail.com">Davide Sottara</a> | ||
*/ | ||
public interface ArrayInit<O extends JavaSource<O>, P extends ExpressionHolder<O>> | ||
extends ExpressionSource<O,P,ArrayInit<O,P>>, | ||
NonPrimitiveExpression<O,P,ArrayInit<O,P>> | ||
{ | ||
|
||
/** | ||
* Adds a sub-array literal to this array constructing expression | ||
* @param subRow The sub-array | ||
* @return The <code>ArrayInit</code> itself | ||
*/ | ||
public ArrayInit<O,P> addElement(ArrayInit<?,?> subRow); | ||
|
||
/** | ||
* Adds an element to this array constructing expression | ||
* @param subElement The expression returning the element to be addeed to the array | ||
* @return The <code>ArrayInit</code> itself | ||
*/ | ||
public ArrayInit<O,P> addElement(ExpressionSource<?,?,?> subElement); | ||
|
||
/** | ||
* Returns the current elements used to initialize the array | ||
* @return An immutable list containing the element expressions | ||
*/ | ||
public List<ExpressionSource<O,ArrayInit<O,P>,?>> getElements(); | ||
|
||
/** | ||
* Counts and returns the number of elements in this array | ||
* @return | ||
*/ | ||
public int size(); | ||
|
||
/** | ||
* Returns the number of dimensions in the array, as inferred by the init expressions | ||
* Example : { {1}, {2}, {3} } size() is 3, but getDimension() is 2 | ||
* @return the dimension | ||
*/ | ||
public int getDimension(); | ||
|
||
} |
Oops, something went wrong.