Skip to content

Commit

Permalink
Java Statement Fluent Model
Browse files Browse the repository at this point in the history
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
sotty committed Jul 24, 2015
1 parent ef908ef commit 81e025f
Show file tree
Hide file tree
Showing 178 changed files with 11,024 additions and 22 deletions.
18 changes: 18 additions & 0 deletions api/src/main/java/org/jboss/forge/roaster/model/Block.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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;

public interface Block<O extends JavaType<O>,
P extends BlockHolder<O>>
extends Origin<P>,
BlockHolder<O> {

}
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>> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package org.jboss.forge.roaster.model;

import org.jboss.forge.roaster.Roaster;
import org.jboss.forge.roaster.model.source.JavaClassSource;

/**
* Represents a Java {@code class} type. See {@link Roaster} for various options in generating {@link JavaClass}
Expand All @@ -33,4 +34,5 @@ public interface JavaClass<O extends JavaClass<O>> extends
*/
public boolean isLocalClass();

public JavaClassSource asJavaClassSource();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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;

public interface AccessBuilder<O extends JavaSource<O>,
P extends ExpressionHolder<O>,
E extends NonPrimitiveExpression<O,P,E>> {

public Field<O,E> field( String field );

public Getter<O,E> getter( String field, String klass );

public Getter<O,E> getter( String field, Class klass );

public Setter<O,E> setter( String fldName, String type, ExpressionSource<?,?,?> value );

public Setter<O,E> setter( String fldName, Class type, ExpressionSource<?,?,?> value );

public MethodCallExpression<O,E> invoke( String method );

public ArrayIndexer<O,E> itemAt( ExpressionSource<?,?,?> index );

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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;

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> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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;

public interface Argument<O extends JavaSource<O>,
P extends ExpressionHolder<O>,
E extends ExpressionSource<O,P,E>>
extends ExpressionSource<O,P,E> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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;

public interface ArgumentHolder<O extends JavaSource<O>,
P extends ExpressionHolder<O>,
E extends NonPrimitiveExpression<O,P,?>>
extends ExpressionHolder<O> {

public E addArgument( Argument<?,?,?> arg );

public List<Argument<O,E,?>> getArguments();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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;

public interface ArrayConstructorExpression<O extends JavaSource<O>,
P extends ExpressionHolder<O>>
extends Argument<O,P,ArrayConstructorExpression<O,P>>,
NonPrimitiveExpression<O,P,ArrayConstructorExpression<O,P>> {

public ArrayConstructorExpression<O,P> addDimension( ExpressionSource<?,?,?> dim );

public ArrayConstructorExpression<O,P> init( ArrayInit<?,?> array );

public ArrayInit<O,ArrayConstructorExpression<O,P>> getInit();

public List<ExpressionSource<O,ArrayConstructorExpression<O,P>,?>> getDimensions();

public int getDimension();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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;

public interface ArrayIndexer<O extends JavaSource<O>,P extends ExpressionHolder<O>>
extends OrdinalArgument<O,P,ArrayIndexer<O,P>>,
NonPrimitiveExpression<O,P,ArrayIndexer<O,P>> {

public ExpressionSource<O,ArrayIndexer<O,P>,?> getIndex();

public ArrayIndexer<O,P> setIndex( ExpressionSource<?,?,?> index );

public ExpressionSource<O,ArrayIndexer<O,P>,?> getTarget();

public ArrayIndexer<O,P> setTarget( ExpressionSource<?,?,?> target );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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;

public interface ArrayInit<O extends JavaSource<O>,P extends ExpressionHolder<O>>
extends ExpressionSource<O,P,ArrayInit<O,P>>,
NonPrimitiveExpression<O,P,ArrayInit<O,P>> {

public ArrayInit<O,P> addElement( ArrayInit<?,?> subRow );

public ArrayInit<O,P> addElement( ExpressionSource<?,?,?> subElement );

public List<ExpressionSource<O,ArrayInit<O,P>,?>> getElements();

public int size();

public int getDimension();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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;

public interface AssignExpression<O extends JavaSource<O>,
P extends ExpressionHolder<O>>
extends NonPrimitiveExpression<O,P,AssignExpression<O,P>>,
Argument<O,P,AssignExpression<O,P>> {

public String getOperator();

public AssignExpression<O,P> setOperator( Assignment op );

public Accessor<O,AssignExpression<O,P>,?> getLeft();

public AssignExpression<O,P> setLeft( Accessor<?,?,?> left );

public ExpressionSource<O,AssignExpression<O,P>,?> getRight();

public AssignExpression<O,P> setRight( ExpressionSource<?,?,?> right );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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;

public enum Assignment {

ASSIGN( "=" ),
DIVIDE_ASSIGN( "/=" ),
PLUS_ASSIGN( "+=" ),
MINUS_ASSIGN( "-=" ),
TIMES_ASSIGN( "*=" ),
REMAINDER_ASSIGN( "%=" ),

LEFT_SHIFT_ASSIGN( "<<=" ),
RIGHT_SHIFT_ASSIGN( ">>=" ),
RIGHT_SHIFT_UNSIGNED_ASSIGN( ">>>=" ),
BITWISE_XOR_ASSIGN( "^=" ),
BITWISE_AND_ASSIGN( "&=" ),
BITWISE_OR_ASSIGN( "|=" );

private String op;

Assignment( String o ) {
op = o;
}

public String getOp() {
return op;
}


public static Assignment build( String x ) {
for ( Assignment en : Assignment.values() ) {
if ( en.getOp().equals( x ) ) {
return en;
}
}
throw new IllegalStateException( "Unrecognized operation " + x );
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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;

public interface BasicExpressionFactory<O extends JavaSource<O>,
P extends ExpressionHolder<O>>
extends LiteralBuilder<O,P>,
ConstructorBuilder<O,P> {

public Variable<O,P> var( String varName );

public OperatorExpression<O,P> operator( Op op );

public UnaryExpression<O,P> operator( PrefixOp operator, Argument<O,?,?> arg );

public TernaryExpression<O,P> ternary();

public CastExpression<O,P> cast( String klass, ExpressionSource<O,?,?> arg );

public CastExpression<O,P> cast( Class klass, ExpressionSource<O,?,?> arg );

public ParenExpression<O,P> paren( ExpressionSource<O,?,?> inner );

public UnaryExpression<O,P> not( Argument<O,?,?> arg );

public AssignExpression<O,P> assign( Assignment operator );

public DeclareExpression<O,P> declare( String klass, String name );

public DeclareExpression<O,P> declare( Class klass, String name );

public DeclareExpression<O,P> declare( String klass, String name, ExpressionSource<O,?,?> init );

public DeclareExpression<O,P> declare( Class klass, String name, ExpressionSource<O,?,?> init );

public Accessor<O,P,?> classStatic( String klass );

public Accessor<O,P,?> classStatic( Class klass );

public InstanceofExpression<O,P> instanceOf( String klass, ExpressionSource<O,?,?> arg );

public InstanceofExpression<O,P> instanceOf( Class klass, ExpressionSource<O,?,?> arg );

public Super<O,P> sup();

public ArrayInit<O,ArrayConstructorExpression<O,P>> vec();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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;

public interface BooleanLiteral<O extends JavaSource<O>,
P extends ExpressionHolder<O>>
extends PrimitiveLiteral<O,P> {

public Boolean getValue();
}
Loading

0 comments on commit 81e025f

Please sign in to comment.