Skip to content

Commit

Permalink
Java Statement Fluent Model
Browse files Browse the repository at this point in the history
Update Copyright
  • Loading branch information
sotty committed Sep 8, 2014
1 parent 47e58d6 commit 65829f9
Show file tree
Hide file tree
Showing 149 changed files with 6,678 additions and 6 deletions.
29 changes: 29 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,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;

import org.jboss.forge.roaster.Origin;
import org.jboss.forge.roaster.model.source.BlockHolder;
import org.jboss.forge.roaster.model.source.JavaSource;
import org.jboss.forge.roaster.model.source.MethodSource;
import org.jboss.forge.roaster.model.statements.AssignStatement;
import org.jboss.forge.roaster.model.statements.BlockStatement;
import org.jboss.forge.roaster.model.statements.DeclareStatement;
import org.jboss.forge.roaster.model.statements.ForEachStatement;
import org.jboss.forge.roaster.model.statements.ForStatement;
import org.jboss.forge.roaster.model.statements.IfStatement;
import org.jboss.forge.roaster.model.statements.InvokeStatement;
import org.jboss.forge.roaster.model.statements.ReturnStatement;
import org.jboss.forge.roaster.model.statements.Statement;
import org.jboss.forge.roaster.model.statements.WhileStatement;

public interface Block<O extends JavaSource<O>, T extends BlockHolder<O,?>>
extends Origin<T>,
BlockHolder<O,Block<O,T>> {

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

public interface AbstractInvokeExpression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T>,
ChainableExpression<O, T> {

}
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.source.JavaSource;

public interface AccessBuilder<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Expression<O,T> {

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

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

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

public Setter<O, T> setter( String fldName, String type, Expression<O, Setter<O, T>> value );

public Setter<O, T> setter( String fldName, Class type, Expression<O, Setter<O, T>> value );

public MethodExpression<O, T> invoke( String method );

public AccessBuilder<O,T> itemAt( Expression<O,ArrayIndexer<O,T>> index );

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

public interface Accessor<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T>,
AccessBuilder<O, T> {

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

public interface Argument<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Expression<O, T> {

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

public interface ArgumentHolder<O extends JavaSource<O>, X extends ExpressionSource<O>> {

public ArgumentHolder<O,X> addArgument( Argument<O, X> arg );
}
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.expressions;

import org.jboss.forge.roaster.model.source.JavaSource;

public interface ArrayConstructorExpression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T> {

public ArrayConstructorExpression<O,T> addDimension( Expression<O,ArrayConstructorExpression<O,T>> dim );

public ArrayConstructorExpression<O,T> init( ArrayInit<O,ArrayConstructorExpression<O,T>> array );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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.source.JavaSource;

public interface ArrayIndexer<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends BareArgument<O, T> {

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

public interface ArrayInit<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends ExpressionSource<O> {

public ArrayInit<O,T> addElement( ArrayInit<O,T> subRow );

public ArrayInit<O,T> addElement( Expression<O,T> subElement );

public int size();

}
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.source.JavaSource;

public interface AssignExpression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends ExpressionSource<O>,
Argument<O, T> {

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

public AssignExpression<O, T> setRight( Expression right );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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;
}
}
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.expressions;

import org.jboss.forge.roaster.model.source.JavaSource;

public interface BareArgument<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T>,
Accessor<O, T>,
Wireable<O,T> {

public Argument<O, T> inc();

public Argument<O, T> dec();

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

public interface CastExpression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T> {

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


public interface ChainableExpression<O extends JavaSource<O>, T extends ExpressionSource<O>> {

public Accessor<O, T> dot();

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

public interface ClassLiteral<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Literal<O, T>,
Accessor<O, T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.source.JavaSource;

public interface ConstructorBuilder<O extends JavaSource<O>, T extends ExpressionSource<O>> {

public ConstructorExpression<O,T> newInstance( String klass );

public ConstructorExpression<O,T> newInstance( Class<?> klass );

public ArrayConstructorExpression<O,T> newArray( Class<?> klass );

public ArrayConstructorExpression<O,T> newArray( String klass );

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

public interface ConstructorExpression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T> {

public ConstructorExpression<O,T> addArgument( Argument<O, ConstructorExpression<O,T>> arg );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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.source.JavaSource;

public interface DeclareExpression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends Argument<O, T> {

public DeclareExpression<O, T> init( Expression expr );

}
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.expressions;

import org.jboss.forge.roaster.Origin;
import org.jboss.forge.roaster.model.source.JavaSource;

public interface Expression<O extends JavaSource<O>, T extends ExpressionSource<O>>
extends ExpressionSource<O>,
Origin<T> {


}
Loading

0 comments on commit 65829f9

Please sign in to comment.