Tabnine Logo
Expressions.callConstructor
Code IndexAdd Tabnine to your IDE (free)

How to use
callConstructor
method
in
com.yahoo.aptutils.writer.expressions.Expressions

Best Java code snippets using com.yahoo.aptutils.writer.expressions.Expressions.callConstructor (Showing top 8 results out of 315)

origin: yahoo/squidb

@Override
public void emitPropertyDeclaration(JavaFileWriter writer) throws IOException {
  if (isDeprecated) {
    writer.writeAnnotation(CoreTypes.DEPRECATED);
  }
  List<Object> constructorArgs = new ArrayList<>();
  constructorArgs.add(TableModelFileWriter.TABLE_MODEL_NAME);
  constructorArgs.add("\"" + columnName + "\"");
  String columnDef = getColumnDefinition();
  if (!AptUtils.isEmpty(columnDef)) {
    constructorArgs.add(columnDef);
  }
  writer.writeFieldDeclaration(getPropertyType(), propertyName,
      Expressions.callConstructor(getPropertyType(), constructorArgs), TypeConstants.PUBLIC_STATIC_FINAL);
}
origin: yahoo/squidb

private void emitTableDeclaration() throws IOException {
  writer.writeComment("--- table declaration");
  List<Object> arguments = new ArrayList<>();
  arguments.add(Expressions.classObject(modelSpec.getGeneratedClassName())); // modelClass
  arguments.add(PROPERTIES_ARRAY_NAME); // properties
  arguments.add("\"" + modelSpec.getSpecAnnotation().tableName().trim() + "\""); // name
  arguments.add(null); // database name, null by default
  if (modelSpec.isVirtualTable()) {
    if (AptUtils.isEmpty(modelSpec.getSpecAnnotation().virtualModule())) {
      modelSpec.logError("virtualModule should be non-empty for virtual table models",
          modelSpec.getModelSpecElement());
    }
    arguments.add("\"" + modelSpec.getSpecAnnotation().virtualModule() + "\"");
  } else if (!AptUtils.isEmpty(modelSpec.getSpecAnnotation().tableConstraint())) {
    arguments.add("\"" + modelSpec.getSpecAnnotation().tableConstraint() + "\"");
  }
  writer.writeFieldDeclaration(modelSpec.getTableType(), TABLE_NAME,
      Expressions.callConstructor(modelSpec.getTableType(), arguments), TypeConstants.PUBLIC_STATIC_FINAL);
  writer.writeFieldDeclaration(TypeConstants.TABLE_MODEL_NAME, TABLE_MODEL_NAME,
      Expressions.callConstructor(TypeConstants.TABLE_MODEL_NAME,
          Expressions.classObject(modelSpec.getGeneratedClassName()),
          Expressions.callMethodOn(TableModelFileWriter.TABLE_NAME, "getName")),
      TypeConstants.PUBLIC_STATIC_FINAL);
  writer.writeNewline();
}
origin: yahoo/squidb

  @Override
  public void afterEmitMethods(JavaFileWriter writer) throws IOException {
    // emit creator for parcelable
    writer.writeComment("--- parcelable helpers");
    List<DeclaredTypeName> genericList = Collections.singletonList(modelSpec.getGeneratedClassName());
    DeclaredTypeName creatorType = TypeConstants.CREATOR.clone();
    DeclaredTypeName modelCreatorType = TypeConstants.MODEL_CREATOR.clone();
    creatorType.setTypeArgs(genericList);
    modelCreatorType.setTypeArgs(genericList);

    writer.writeFieldDeclaration(creatorType,
        "CREATOR", Expressions.callConstructor(modelCreatorType,
            Expressions.classObject(modelSpec.getGeneratedClassName())),
        TypeConstants.PUBLIC_STATIC_FINAL)
        .writeNewline();
  }
}
origin: yahoo/squidb

protected void emitDefaultValues() throws IOException {
  writer.writeComment("--- default values");
  writer.writeFieldDeclaration(TypeConstants.VALUES_STORAGE, DEFAULT_VALUES_NAME,
      Expressions.callMethodOn(
          Expressions.callConstructor(modelSpec.getGeneratedClassName()), "newValuesStorage"),
      Modifier.PROTECTED, Modifier.STATIC, Modifier.FINAL);
  if (pluginEnv.hasSquidbOption(PluginEnvironment.OPTIONS_DISABLE_DEFAULT_VALUES)) {
    writer.writeComment("--- property defaults disabled by plugin flag");
  } else {
    writer.beginInitializerBlock(true, true)
        .writeComment("--- put property defaults");
    emitDefaultValuesInitializationBlock();
    writer.finishInitializerBlock(false, true).writeNewline();
  }
  writer.writeAnnotation(CoreTypes.OVERRIDE)
      .beginMethodDefinition(GET_DEFAULT_VALUES_PARAMS)
      .writeStringStatement("return " + DEFAULT_VALUES_NAME)
      .finishMethodDefinition();
}
origin: com.yahoo.squidb/squidb-processor

@Override
public void emitPropertyDeclaration(JavaFileWriter writer) throws IOException {
  if (isDeprecated) {
    writer.writeAnnotation(CoreTypes.DEPRECATED);
  }
  List<Object> constructorArgs = new ArrayList<>();
  constructorArgs.add(TableModelFileWriter.TABLE_MODEL_NAME);
  constructorArgs.add("\"" + columnName + "\"");
  String columnDef = getColumnDefinition();
  if (!AptUtils.isEmpty(columnDef)) {
    constructorArgs.add(columnDef);
  }
  writer.writeFieldDeclaration(getPropertyType(), propertyName,
      Expressions.callConstructor(getPropertyType(), constructorArgs), TypeConstants.PUBLIC_STATIC_FINAL);
}
origin: com.yahoo.squidb/squidb-processor

private void emitTableDeclaration() throws IOException {
  writer.writeComment("--- table declaration");
  List<Object> arguments = new ArrayList<>();
  arguments.add(Expressions.classObject(modelSpec.getGeneratedClassName())); // modelClass
  arguments.add(PROPERTIES_ARRAY_NAME); // properties
  arguments.add("\"" + modelSpec.getSpecAnnotation().tableName().trim() + "\""); // name
  arguments.add(null); // database name, null by default
  if (modelSpec.isVirtualTable()) {
    if (AptUtils.isEmpty(modelSpec.getSpecAnnotation().virtualModule())) {
      modelSpec.logError("virtualModule should be non-empty for virtual table models",
          modelSpec.getModelSpecElement());
    }
    arguments.add("\"" + modelSpec.getSpecAnnotation().virtualModule() + "\"");
  } else if (!AptUtils.isEmpty(modelSpec.getSpecAnnotation().tableConstraint())) {
    arguments.add("\"" + modelSpec.getSpecAnnotation().tableConstraint() + "\"");
  }
  writer.writeFieldDeclaration(modelSpec.getTableType(), TABLE_NAME,
      Expressions.callConstructor(modelSpec.getTableType(), arguments), TypeConstants.PUBLIC_STATIC_FINAL);
  writer.writeFieldDeclaration(TypeConstants.TABLE_MODEL_NAME, TABLE_MODEL_NAME,
      Expressions.callConstructor(TypeConstants.TABLE_MODEL_NAME,
          Expressions.classObject(modelSpec.getGeneratedClassName()),
          Expressions.callMethodOn(TableModelFileWriter.TABLE_NAME, "getName")),
      TypeConstants.PUBLIC_STATIC_FINAL);
  writer.writeNewline();
}
origin: com.yahoo.squidb/squidb-processor

  @Override
  public void afterEmitMethods(JavaFileWriter writer) throws IOException {
    // emit creator for parcelable
    writer.writeComment("--- parcelable helpers");
    List<DeclaredTypeName> genericList = Collections.singletonList(modelSpec.getGeneratedClassName());
    DeclaredTypeName creatorType = TypeConstants.CREATOR.clone();
    DeclaredTypeName modelCreatorType = TypeConstants.MODEL_CREATOR.clone();
    creatorType.setTypeArgs(genericList);
    modelCreatorType.setTypeArgs(genericList);

    writer.writeFieldDeclaration(creatorType,
        "CREATOR", Expressions.callConstructor(modelCreatorType,
            Expressions.classObject(modelSpec.getGeneratedClassName())),
        TypeConstants.PUBLIC_STATIC_FINAL)
        .writeNewline();
  }
}
origin: com.yahoo.squidb/squidb-processor

protected void emitDefaultValues() throws IOException {
  writer.writeComment("--- default values");
  writer.writeFieldDeclaration(TypeConstants.VALUES_STORAGE, DEFAULT_VALUES_NAME,
      Expressions.callMethodOn(
          Expressions.callConstructor(modelSpec.getGeneratedClassName()), "newValuesStorage"),
      Modifier.PROTECTED, Modifier.STATIC, Modifier.FINAL);
  if (pluginEnv.hasSquidbOption(PluginEnvironment.OPTIONS_DISABLE_DEFAULT_VALUES)) {
    writer.writeComment("--- property defaults disabled by plugin flag");
  } else {
    writer.beginInitializerBlock(true, true)
        .writeComment("--- put property defaults");
    emitDefaultValuesInitializationBlock();
    writer.finishInitializerBlock(false, true).writeNewline();
  }
  writer.writeAnnotation(CoreTypes.OVERRIDE)
      .beginMethodDefinition(GET_DEFAULT_VALUES_PARAMS)
      .writeStringStatement("return " + DEFAULT_VALUES_NAME)
      .finishMethodDefinition();
}
com.yahoo.aptutils.writer.expressionsExpressionscallConstructor

Popular methods of Expressions

  • classObject
  • staticMethod
  • arrayAllocation
  • arrayReference
  • assign
  • block
  • callMethod
  • callMethodOn
  • fromString
  • reference
  • staticReference
  • staticReference

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JFileChooser (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Table (org.hibernate.mapping)
    A relational table
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now