@Override
 protected List<? extends TypeBodyDeclaration> override(Context context) {
   ImplementationBuilder builder = new ImplementationBuilder(context);
   ModelFactory f = context.environment.getFactory();
   builder.addStatement(
       new TypeBuilder(f, context.importer.toType(UnsupportedOperationException.class))
           .newObject(Models.toLiteral(f, "単純集計演算子は組み込みの方法で処理されます"))
           .toThrowStatement());
   return builder.toImplementation();
 }
Exemplo n.º 2
0
    private List<Statement> createReaderBody() {
      List<Statement> results = new ArrayList<Statement>();

      results.add(
          f.newIfStatement(
              new ExpressionBuilder(f, createParserFieldName())
                  .method("next")
                  .apply(InfixOperator.EQUALS, Models.toLiteral(f, false))
                  .toExpression(),
              f.newBlock(
                  new ExpressionBuilder(f, Models.toLiteral(f, false)).toReturnStatement())));

      for (PropertyDeclaration property : model.getDeclaredProperties()) {
        results.add(createReaderStatement(property));
      }
      results.add(createEndRecordStatement());
      results.add(f.newReturnStatement(Models.toLiteral(f, true)));
      return results;
    }
Exemplo n.º 3
0
 private List<Statement> createConstructorBody() {
   List<Statement> results = new ArrayList<Statement>();
   results.add(
       f.newIfStatement(
           new ExpressionBuilder(f, createParserFieldName())
               .apply(InfixOperator.EQUALS, Models.toNullLiteral(f))
               .toExpression(),
           f.newBlock(
               new TypeBuilder(f, context.resolve(IllegalArgumentException.class))
                   .newObject(Models.toLiteral(f, createParserFieldName().getToken()))
                   .toThrowStatement())));
   results.add(
       new ExpressionBuilder(f, f.newThis(null))
           .field(createParserFieldName())
           .assignFrom(createParserFieldName())
           .toStatement());
   return results;
 }
 private Expression v(Object value) {
   return Models.toLiteral(factory, value);
 }