Skip to content

Commit

Permalink
Building off of newly generated classes (with a few manual fixes).
Browse files Browse the repository at this point in the history
  • Loading branch information
UnquietCode committed Apr 26, 2012
1 parent d7d5dd8 commit 2994d95
Show file tree
Hide file tree
Showing 88 changed files with 1,961 additions and 441 deletions.
16 changes: 4 additions & 12 deletions src/main/java/unquietcode/tools/flapi/BlockChainHelperImpl.java
Expand Up @@ -5,10 +5,6 @@
import unquietcode.tools.flapi.outline.BlockOutline;
import unquietcode.tools.flapi.outline.MethodOutline;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* @author Ben Fagin
* @version 04-21-2012
Expand All @@ -31,20 +27,16 @@ public void addBlockReference(String blockName) {
}

@Override
public List<Object> startBlock(String blockName) {
public void startBlock(String methodSignature, String blockName, ObjectWrapper<BlockHelper> _helper1) {
BlockOutline anonymousBlock = new BlockOutline();
anonymousBlock.name = blockName;
blockMethod.blockChain.add(0, anonymousBlock);

List<Object> helpers = new ArrayList<Object>();
helpers.add(new BlockHelperImpl(anonymousBlock));
return helpers;
_helper1.set(new BlockHelperImpl(anonymousBlock));
}

@Override
public List<Object> addBlockChain() {
List<Object> helpers = new ArrayList<Object>();
helpers.add(new BlockChainHelperImpl(blockMethod));
return helpers;
public void addBlockChain(ObjectWrapper<BlockChainHelper> _helper1) {
_helper1.set(new BlockChainHelperImpl(blockMethod));
}
}
40 changes: 16 additions & 24 deletions src/main/java/unquietcode/tools/flapi/BlockHelperImpl.java
@@ -1,6 +1,8 @@
package unquietcode.tools.flapi;

import unquietcode.tools.flapi.builder.BlockChainHelper;
import unquietcode.tools.flapi.builder.BlockHelper;
import unquietcode.tools.flapi.builder.MethodHelper;
import unquietcode.tools.flapi.outline.BlockOutline;
import unquietcode.tools.flapi.outline.MethodOutline;

Expand All @@ -18,39 +20,34 @@ public class BlockHelperImpl implements BlockHelper {
public BlockHelperImpl(BlockOutline block) {
this.block = block;
}

@Override
public List<Object> addMethod(String methodSignature) {
return _addMethod(block, methodSignature);
public void addMethod(String methodSignature, ObjectWrapper<MethodHelper> _helper1) {
_addMethod(block, methodSignature, _helper1);
}

static List<Object> _addMethod(BlockOutline block, String methodSignature) {
static void _addMethod(BlockOutline block, String methodSignature, ObjectWrapper<MethodHelper> _helper1) {
MethodOutline m = block.addMethod(methodSignature);
ArrayList<Object> helpers = new ArrayList<Object>();
helpers.add(new MethodHelperImpl(m));
return helpers;
_helper1.set(new MethodHelperImpl(m));
}

@Override
public List<Object> startBlock(String blockName, String methodSignature) {
return _startBlock(block, blockName, methodSignature);
public void startBlock(String blockName, String methodSignature, ObjectWrapper<MethodHelper> _helper1, ObjectWrapper<BlockHelper> _helper2) {
_startBlock(block, blockName, methodSignature, _helper1, _helper2);
}

static List<Object> _startBlock(BlockOutline block, String blockName, String methodSignature) {
static void _startBlock(BlockOutline block, String blockName, String methodSignature, ObjectWrapper<MethodHelper> _helper1, ObjectWrapper<BlockHelper> _helper2) {
BlockOutline newBlock = block.addBlock(blockName);
MethodOutline blockMethod = block.addMethod(methodSignature);
blockMethod.blockChain.add(0, newBlock);
newBlock.constructor = blockMethod;

List<Object> helpers = new ArrayList<Object>();
helpers.add(new MethodHelperImpl(blockMethod));
helpers.add(new BlockHelperImpl(newBlock));

return helpers;
_helper1.set(new MethodHelperImpl(blockMethod));
_helper2.set(new BlockHelperImpl(newBlock));
}

@Override
public List<Object> addBlockReference(String blockName, String methodSignature) {
public void addBlockReference(String blockName, String methodSignature, ObjectWrapper<MethodHelper> _helper1) {
BlockReference blockReference = new BlockReference();
blockReference.name = blockName;

Expand All @@ -60,10 +57,7 @@ public List<Object> addBlockReference(String blockName, String methodSignature)
block.methods.add(blockMethod);
blockReference.constructor = blockMethod;

MethodHelperImpl helper = new MethodHelperImpl(blockMethod);
List<Object> helpers = new ArrayList<Object>();
helpers.add(helper);
return helpers;
_helper1.set(new MethodHelperImpl(blockMethod));
}

@Override
Expand All @@ -72,9 +66,7 @@ public void endBlock() {
}

@Override
public List<Object> addBlockChain() {
List<Object> helpers = new ArrayList<Object>();
helpers.add(new BlockChainHelperImpl(block.constructor));
return helpers;
public void addBlockChain(ObjectWrapper<BlockChainHelper> _helper1) {
_helper1.set(new BlockChainHelperImpl(block.constructor));
}
}
30 changes: 26 additions & 4 deletions src/main/java/unquietcode/tools/flapi/DescriptorHelperImpl.java
@@ -1,6 +1,8 @@
package unquietcode.tools.flapi;

import unquietcode.tools.flapi.builder.BlockHelper;
import unquietcode.tools.flapi.builder.DescriptorHelper;
import unquietcode.tools.flapi.builder.MethodHelper;
import unquietcode.tools.flapi.outline.DescriptorOutline;

import java.util.List;
Expand All @@ -17,6 +19,26 @@ public Descriptor _getReturnValue() {
return new Descriptor(this);
}

@Override
public void setDescriptorName(String descriptorName) {
// nothing
}

@Override
public void setReturnType(Class returnType) {
// nothing
}

@Override
public void setStartingMethodName(String methodName) {
// nothing
}

@Override
public void build() {
// nothing
}

public void _setDescriptorName(String name) {
if (name == null || name.trim().isEmpty()) {
throw new IllegalArgumentException("Name cannot be empty.");
Expand All @@ -40,12 +62,12 @@ public void showLog(boolean value) {
}

@Override
public List<Object> addMethod(String methodSignature) {
return BlockHelperImpl._addMethod(outline.selfBlock, methodSignature);
public void addMethod(String methodSignature, ObjectWrapper<MethodHelper> _helper1) {
BlockHelperImpl._addMethod(outline.selfBlock, methodSignature, _helper1);
}

@Override
public List<Object> startBlock(String blockName, String methodSignature) {
return BlockHelperImpl._startBlock(outline.selfBlock, blockName, methodSignature);
public void startBlock(String blockName, String methodSignature, ObjectWrapper<MethodHelper> _helper1, ObjectWrapper<BlockHelper> _helper2) {
BlockHelperImpl._startBlock(outline.selfBlock, blockName, methodSignature, _helper1, _helper2);
}
}
11 changes: 2 additions & 9 deletions src/main/java/unquietcode/tools/flapi/MethodHelperImpl.java
Expand Up @@ -67,14 +67,7 @@ public void between(int atLeast, int atMost) {
}

@Override
public List<Object> addBlockChain() {
// TODO haven't thought this through yet
// Ideally a helper should not have to implement anything to handle a block reference

BlockChainHelper helper = new BlockChainHelperImpl(method);
List<Object> helpers = new ArrayList<Object>();
helpers.add(helper);

return helpers;
public void addBlockChain(ObjectWrapper<BlockChainHelper> _helper1) {
_helper1.set(new BlockChainHelperImpl(method));
}
}
20 changes: 12 additions & 8 deletions src/main/java/unquietcode/tools/flapi/builder/BlockBuilder.java
@@ -1,12 +1,16 @@

package unquietcode.tools.flapi.builder;

/**
* @author Ben Fagin
* @version 03-04-2012
*/
public interface BlockBuilder<_ReturnType> {
MethodBuilder_addBlockChain<BlockBuilder<_ReturnType>> addMethod(String methodSignature);

public interface BlockBuilder<_ReturnType >{


MethodBuilder_addBlockChain<BlockBuilder<_ReturnType>> addBlockReference(String blockName, String methodSignature);

MethodBuilder_addBlockChain<BlockBuilder<_ReturnType>> addMethod(String methodSignature);

_ReturnType endBlock();

MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<BlockBuilder<_ReturnType>>> startBlock(String blockName, String methodSignature);
MethodBuilder_addBlockChain<BlockBuilder<_ReturnType>> addBlockReference(String blockName, String methodSignature);
_ReturnType endBlock();

}
@@ -1,14 +1,18 @@

package unquietcode.tools.flapi.builder;

/**
* @author Ben Fagin
* @version 04-21-2012
*/
public interface BlockBuilder_addBlockChain<_ReturnType> {
MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<_ReturnType>> addMethod(String methodSignature);

public interface BlockBuilder_addBlockChain<_ReturnType >{


MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<_ReturnType>> addBlockReference(String blockName, String methodSignature);

MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<_ReturnType>> addMethod(String methodSignature);

_ReturnType endBlock();

MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<BlockBuilder_addBlockChain<_ReturnType>>> startBlock(String blockName, String methodSignature);
MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<_ReturnType>> addBlockReference(String blockName, String methodSignature);
_ReturnType endBlock();

BlockChainBuilder_addBlockChain<BlockBuilder<_ReturnType>> addBlockChain();
BlockChainBuilder_addBlockChain<BlockBuilder<_ReturnType>> addBlockChain();

}
@@ -1,10 +1,12 @@

package unquietcode.tools.flapi.builder;

/**
* @author Ben Fagin
* @version 03-07-2012
*/
public interface BlockChainBuilder<_ReturnType> {
_ReturnType addBlockReference(String blockName);
_ReturnType startBlock(String blockName);

public interface BlockChainBuilder<_ReturnType >{


_ReturnType addBlockReference(String blockName);

BlockBuilder_addBlockChain<_ReturnType> startBlock(String methodSignature, String blockName);

}
@@ -1,12 +1,14 @@

package unquietcode.tools.flapi.builder;

/**
* @author Ben Fagin
* @version 04-21-2012
*/
public interface BlockChainBuilder_addBlockChain<_ReturnType> {
_ReturnType addBlockReference(String blockName);
_ReturnType startBlock(String blockName);

BlockChainBuilder<_ReturnType> addBlockChain(String blockName);
public interface BlockChainBuilder_addBlockChain<_ReturnType >{


_ReturnType addBlockReference(String blockName);

BlockBuilder_addBlockChain<_ReturnType> startBlock(String methodSignature, String blockName);

BlockChainBuilder_addBlockChain<BlockChainBuilder<_ReturnType>> addBlockChain();

}
@@ -1,13 +1,15 @@

package unquietcode.tools.flapi.builder;

import java.util.List;
import unquietcode.tools.flapi.ObjectWrapper;

/**
* @author Ben Fagin
* @version 04-21-2012
*/
public interface BlockChainHelper {
void addBlockReference(String blockName);
List<Object> startBlock(String blockName);
List<Object> addBlockChain();


void addBlockChain(ObjectWrapper<BlockChainHelper> _helper1);

void startBlock(String methodSignature, String blockName, ObjectWrapper<BlockHelper> _helper1);

void addBlockReference(String blockName);

}
23 changes: 13 additions & 10 deletions src/main/java/unquietcode/tools/flapi/builder/BlockHelper.java
@@ -1,16 +1,19 @@

package unquietcode.tools.flapi.builder;

import java.util.List;
import unquietcode.tools.flapi.ObjectWrapper;

/**
* @author Ben Fagin
* @version 03-04-2012
*/
public interface BlockHelper {
List<Object> addMethod(String methodSignature);
List<Object> startBlock(String blockName, String methodSignature);
List<Object> addBlockReference(String blockName, String methodSignature);
List<Object> addBlockChain();

void endBlock();

void addMethod(String methodSignature, ObjectWrapper<MethodHelper> _helper1);

void addBlockReference(String blockName, String methodSignature, ObjectWrapper<MethodHelper> _helper1);

void endBlock();

void addBlockChain(ObjectWrapper<BlockChainHelper> _helper1);

void startBlock(String blockName, String methodSignature, ObjectWrapper<MethodHelper> _helper1, ObjectWrapper<BlockHelper> _helper2);

}
@@ -1,11 +1,14 @@

package unquietcode.tools.flapi.builder;

/**
* @author Ben Fagin
* @version 03-04-2012
*/
public interface DescriptorBuilder<_ReturnType> {
_ReturnType build();
MethodBuilder_addBlockChain<DescriptorBuilder<_ReturnType>> addMethod(String methodSignature);
MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<DescriptorBuilder<_ReturnType>>> startBlock(String blockName, String methodSignature);
}

public interface DescriptorBuilder<_ReturnType >{


MethodBuilder_addBlockChain<DescriptorBuilder<_ReturnType>> addMethod(String methodSignature);

_ReturnType build();

MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<DescriptorBuilder<_ReturnType>>> startBlock(String blockName, String methodSignature);

}
@@ -0,0 +1,16 @@

package unquietcode.tools.flapi.builder;


public interface DescriptorBuilder_setDescriptorName<_ReturnType >{


MethodBuilder_addBlockChain<DescriptorBuilder_setDescriptorName<_ReturnType>> addMethod(String methodSignature);

_ReturnType build();

MethodBuilder_addBlockChain<BlockBuilder_addBlockChain<DescriptorBuilder_setDescriptorName<_ReturnType>>> startBlock(String blockName, String methodSignature);

DescriptorBuilder<_ReturnType> setDescriptorName(String descriptorName);

}

0 comments on commit 2994d95

Please sign in to comment.