Package rocket.generator.rebind.type

Examples of rocket.generator.rebind.type.Type


*/
public class TestBuilderGenerator extends Generator {

  protected NewConcreteType assembleNewType(final Type type, final String newTypeName) {
    final NewConcreteType testBuilder = this.createTestBuilder(newTypeName);
    final Type webPageTestRunner = this.getTestRunner(type);
    this.addBuildCandidates(testBuilder, webPageTestRunner);
    return testBuilder;
  }
View Full Code Here


    final List webPageTestRunners = method.getMetadataValues(Constants.TEST_ANNOTATION);
    if (webPageTestRunners.size() != 1) {
      throwTestAnnotationProblem(type);
    }
    final String webPageTestRunnerName = (String) webPageTestRunners.get(0);
    final Type webPageTestRunner = this.getGeneratorContext().findType(webPageTestRunnerName);
    if (null == webPageTestRunner) {
      throwUnableToFindTest(webPageTestRunnerName);
    }
    this.getGeneratorContext().info("Test type is " + webPageTestRunnerName);
    return webPageTestRunner;
View Full Code Here

    newMethod.setNative(false);

    final BuildCandidatesTemplatedFile body = new BuildCandidatesTemplatedFile();
    newMethod.setBody(body);

    final Type voidType = this.getGeneratorContext().getVoid();

    final List<Method> methods = new ArrayList<Method>();

    // find and add public methods that start with test
    final VirtualMethodVisitor testMethodFinder = new VirtualMethodVisitor() {

      protected boolean visit(final Method method) {

        while (true) {
          if (method.getVisibility() != Visibility.PUBLIC) {
            break;
          }
          if (false == method.getName().startsWith(Constants.TEST_METHOD_NAME_PREFIX)) {
            context.debug("Ignoring method " + method + " because it doesnt start with public.");
            break;
          }

          // test method must return void
          final Type returnType = method.getReturnType();
          if (returnType != voidType) {
            throwTestMethodDoesntReturnVoid(method);
          }

          // test method must have no parameters.
View Full Code Here

    Checker.notNull("parameter:aspects", aspects);
    this.aspects = aspects;
  }

  protected CodeBlock getAddAdvices() {
    final Type beanFactory = this.getBeanFactory();
    final AddAdviceTemplatedFile addAdvice = new AddAdviceTemplatedFile();

    return new CollectionTemplatedCodeBlock<Aspect>() {

      @Override
View Full Code Here

  protected CodeBlock getRethrowExpectedExceptions() {
    // first build up a list of the exceptions that should be handled.
    final Method method = this.getMethod();
    final GeneratorContext context = method.getGeneratorContext();
    final List<Type> alreadyCaughts = new ArrayList<Type>();
    final Type exception = context.getType(Constants.EXCEPTION);
    final Type runtimeException = context.getType(Constants.RUNTIME_EXCEPTION);

    final List<Type> catchAndRethrow = new ArrayList<Type>();
    final Iterator<Type> thrown = this.getMethod().getThrownTypes().iterator();

    while (thrown.hasNext()) {
      final Type expected = thrown.next();

      if (expected.isAssignableTo(runtimeException)) {
        continue;
      }

      if (false == expected.isAssignableTo(exception)) {
        continue;
      }

      boolean dontCatch = false;
      final Iterator<Type> alreadyCaughtsIterator = alreadyCaughts.iterator();
      while (alreadyCaughtsIterator.hasNext()) {
        final Type alreadyCaught = (Type) alreadyCaughtsIterator.next();
        if (expected.isAssignableTo(alreadyCaught)) {
          dontCatch = true;
          break;
        }
      }
View Full Code Here

    }
    buf.append(this.getVisibility().toString());
    buf.append(' ');// Yes package private methods will have two spaces
    // here...

    final Type returnType = this.getReturnType();
    buf.append(returnType.getName());
    buf.append(' ');

    buf.append(this.getName());
    buf.append('(');

    final Iterator<MethodParameter> parameters = this.getParameters().iterator();
    while (parameters.hasNext()) {
      final MethodParameter parameter = parameters.next();
      final Type parameterType = parameter.getType();
      buf.append(parameterType.getName());

      if (parameters.hasNext()) {
        buf.append(',');
      }
    }
View Full Code Here

    final Set<Type> visited = this.getVisited();

    final Iterator<Type> subTypes = type.getSubTypes().iterator();
    while (subTypes.hasNext()) {
      final Type subType = (Type) subTypes.next();
      if (visited.contains(subType)) {
        continue;
      }

      if (this.visit(subType)) {
View Full Code Here

    if (false == types.isEmpty()) {
      writer.print("throws ");

      final Iterator typesIterator = types.iterator();
      while (typesIterator.hasNext()) {
        final Type type = (Type) typesIterator.next();
        writer.print(type.getName());

        if (typesIterator.hasNext()) {
          writer.print(",");
        }
      }
View Full Code Here

          if (Visibility.PRIVATE == visibility) {
            break;
          }
          // different pacakge skip this method.
          if (Visibility.PACKAGE_PRIVATE == visibility) {
            final Type enclosingType = method.getEnclosingType();
            if (false == packagee.equals(enclosingType.getPackage())) {
              break;
            }
          }

          if (false == visited.contains(method)) {
View Full Code Here

  }

  abstract protected boolean skipArray(Type array);

  protected void visitArray(final Type array) {
    final Type componentType = array.getComponentType();

    this.visitType(componentType);
  }
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.type.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.