コード例 #1
0
 @Override
 public Optional<String> transform(Generator cg, InterfaceField model) {
   return Optional.of(
       cg.on(model.getJavadoc()).orElse(EMPTY)
           + (model.getModifiers().contains(FINAL) ? cg.on(FINAL).get() + SPACE : EMPTY)
           + cg.on(model.getType()).orElse(EMPTY)
           + SPACE
           + model.getName());
 }
コード例 #2
0
ファイル: FileView.java プロジェクト: janebabra/speedment
  @Override
  public Optional<String> transform(Generator cg, File model) {
    final DependencyManager mgr = cg.getDependencyMgr();
    final Optional<String> className = fileToClassName(model.getName());
    Optional<String> packageName = packageName(className.orElse(EMPTY));
    mgr.clearDependencies();

    if (packageName.isPresent()) {
      if (mgr.isIgnored(packageName.get())) {
        packageName = Optional.empty();
      } else {
        mgr.ignorePackage(packageName.get());
      }
    }

    final Optional<String> view =
        Optional.of(
            renderJavadoc(cg, model)
                + renderPackage(model)
                + renderImports(cg, model)
                + renderClasses(cg, model));

    if (packageName.isPresent()) {
      mgr.acceptPackage(packageName.get());
    }

    return view;
  }