congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Expressions.callMethod
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: yahoo/squidb

/**
 * Subclasses can override this hook to generate a custom method body for the property setter. This version of the
 * hook is deprecated, users should use {@link #writeGetterBody(JavaFileWriter, MethodDeclarationParameters)}
 * instead.
 */
@Deprecated
protected void writeSetterBody(JavaFileWriter writer, String argName) throws IOException {
  writer.writeStatement(Expressions.callMethod("set", propertyName, argName));
  writer.writeStringStatement("return this");
}
origin: yahoo/squidb

@Override
protected void writeSetterBody(JavaFileWriter writer, MethodDeclarationParameters params) throws IOException {
  String argName = params.getArgumentNames().get(0);
  final String argAsString = argName + "AsString";
  Expression condition = Expressions.fromString(argName + " == null");
  Expression ifTrue = Expressions.fromString("null");
  Expression ifFalse = Expressions.callMethodOn(argName, "name");
  writer.writeFieldDeclaration(CoreTypes.JAVA_STRING, argAsString,
      new TernaryExpression(condition, ifTrue, ifFalse));
  writer.writeStatement(Expressions.callMethod("set", propertyName, argAsString));
  writer.writeStringStatement("return this");
}
origin: yahoo/squidb

    .setArgumentNames(valuesName);
writer.beginConstructorDeclaration(params)
    .writeStatement(Expressions.callMethod("this", valuesName,
        ModelFileWriter.PROPERTIES_ARRAY_NAME))
    .finishMethodDefinition();
origin: yahoo/squidb

/**
 * Subclasses can override this hook to generate a custom method body for the property getter. This version of the
 * hook is deprecated, users should use {@link #writeGetterBody(JavaFileWriter, MethodDeclarationParameters)}
 * instead.
 */
@Deprecated
protected void writeGetterBody(JavaFileWriter writer) throws IOException {
  writer.writeStatement(Expressions.callMethod("get", propertyName).returnExpr());
}
origin: com.yahoo.squidb/squidb-processor

@Override
protected void writeSetterBody(JavaFileWriter writer, MethodDeclarationParameters params) throws IOException {
  String argName = params.getArgumentNames().get(0);
  final String argAsString = argName + "AsString";
  Expression condition = Expressions.fromString(argName + " == null");
  Expression ifTrue = Expressions.fromString("null");
  Expression ifFalse = Expressions.callMethodOn(argName, "name");
  writer.writeFieldDeclaration(CoreTypes.JAVA_STRING, argAsString,
      new TernaryExpression(condition, ifTrue, ifFalse));
  writer.writeStatement(Expressions.callMethod("set", propertyName, argAsString));
  writer.writeStringStatement("return this");
}
origin: yahoo/squidb

private void emitTableModelMapper() throws IOException {
  writer.writeComment("--- mappers");
  writer.writeFieldDeclaration(TypeConstants.TABLE_MAPPING_VISITORS, "tableMappingInfo",
      Expressions.callMethod("generateTableMappingVisitors",
          PROPERTIES_ARRAY_NAME, ALIASED_PROPERTY_ARRAY_NAME, BASE_PROPERTY_ARRAY_NAME),
      TypeConstants.PRIVATE_STATIC_FINAL)
      .writeNewline();
  writer.writeAnnotation(CoreTypes.OVERRIDE)
      .beginMethodDefinition(GET_TABLE_MAPPING_VISITORS)
      .writeStringStatement("return tableMappingInfo")
      .finishMethodDefinition();
}
origin: com.yahoo.squidb/squidb-processor

    .setArgumentNames(valuesName);
writer.beginConstructorDeclaration(params)
    .writeStatement(Expressions.callMethod("this", valuesName,
        ModelFileWriter.PROPERTIES_ARRAY_NAME))
    .finishMethodDefinition();
origin: yahoo/squidb

@Override
protected void writeGetterBody(JavaFileWriter writer, MethodDeclarationParameters params) throws IOException {
  final String value = "value";
  writer.writeFieldDeclaration(CoreTypes.JAVA_STRING, value,
      Expressions.callMethod("get", propertyName));
  Expression condition = Expressions.fromString(value + " == null");
  Expression ifTrue = Expressions.fromString("null");
  Expression ifFalse = Expressions.staticMethod(enumType, "valueOf", value);
  TernaryExpression ternary = new TernaryExpression(condition, ifTrue, ifFalse);
  writer.writeStatement(ternary.returnExpr());
}
origin: yahoo/squidb

private void emitAliasedPropertyArray() throws IOException {
  writer.writeComment("--- aliased property references");
  Expression aliasedPropertiesInit = Expressions.block(new Expression() {
    @Override
    public boolean writeExpression(JavaFileWriter writer) throws IOException {
      return emitPropertyReferenceArrayBody(true);
    }
  }, false, false, false, false);
  writer.writeFieldDeclaration(TypeConstants.PROPERTY_ARRAY, ALIASED_PROPERTY_ARRAY_NAME,
      aliasedPropertiesInit, TypeConstants.PUBLIC_STATIC_FINAL)
      .writeNewline();
  writer.beginInitializerBlock(true, true);
  writer.writeStatement(Expressions.callMethod("validateAliasedProperties", ALIASED_PROPERTY_ARRAY_NAME));
  writer.finishInitializerBlock(false, true);
  writer.writeNewline();
}
origin: yahoo/squidb

@Override
public void emitConstructors(JavaFileWriter writer) throws IOException {
  if (generateConstructors) {
    String valuesName = "contentValues";
    DeclaredTypeName valuesType = TypeConstants.CONTENT_VALUES;
    MethodDeclarationParameters params = new MethodDeclarationParameters()
        .setModifiers(Modifier.PUBLIC)
        .setConstructorName(modelSpec.getGeneratedClassName());
    params.setArgumentTypes(Collections.singletonList(valuesType))
        .setArgumentNames(valuesName);
    writer.beginConstructorDeclaration(params)
        .writeStatement(Expressions.callMethod("this", valuesName,
            ModelFileWriter.PROPERTIES_ARRAY_NAME))
        .finishMethodDefinition();
    String methodName = "readPropertiesFromContentValues";
    params.setArgumentTypes(Arrays.asList(valuesType, TypeConstants.PROPERTY_VARARGS))
        .setArgumentNames(valuesName, "withProperties");
    writer.beginConstructorDeclaration(params)
        .writeStringStatement("this()")
        .writeStringStatement(methodName + "(" + valuesName + ", withProperties)")
        .finishMethodDefinition();
  }
}
origin: com.yahoo.squidb/squidb-processor

/**
 * Subclasses can override this hook to generate a custom method body for the property setter. This version of the
 * hook is deprecated, users should use {@link #writeGetterBody(JavaFileWriter, MethodDeclarationParameters)}
 * instead.
 */
@Deprecated
protected void writeSetterBody(JavaFileWriter writer, String argName) throws IOException {
  writer.writeStatement(Expressions.callMethod("set", propertyName, argName));
  writer.writeStringStatement("return this");
}
origin: com.yahoo.squidb/squidb-processor

/**
 * Subclasses can override this hook to generate a custom method body for the property getter. This version of the
 * hook is deprecated, users should use {@link #writeGetterBody(JavaFileWriter, MethodDeclarationParameters)}
 * instead.
 */
@Deprecated
protected void writeGetterBody(JavaFileWriter writer) throws IOException {
  writer.writeStatement(Expressions.callMethod("get", propertyName).returnExpr());
}
origin: com.yahoo.squidb/squidb-processor

@Override
protected void writeGetterBody(JavaFileWriter writer, MethodDeclarationParameters params) throws IOException {
  final String value = "value";
  writer.writeFieldDeclaration(CoreTypes.JAVA_STRING, value,
      Expressions.callMethod("get", propertyName));
  Expression condition = Expressions.fromString(value + " == null");
  Expression ifTrue = Expressions.fromString("null");
  Expression ifFalse = Expressions.staticMethod(enumType, "valueOf", value);
  TernaryExpression ternary = new TernaryExpression(condition, ifTrue, ifFalse);
  writer.writeStatement(ternary.returnExpr());
}
origin: com.yahoo.squidb/squidb-processor

private void emitTableModelMapper() throws IOException {
  writer.writeComment("--- mappers");
  writer.writeFieldDeclaration(TypeConstants.TABLE_MAPPING_VISITORS, "tableMappingInfo",
      Expressions.callMethod("generateTableMappingVisitors",
          PROPERTIES_ARRAY_NAME, ALIASED_PROPERTY_ARRAY_NAME, BASE_PROPERTY_ARRAY_NAME),
      TypeConstants.PRIVATE_STATIC_FINAL)
      .writeNewline();
  writer.writeAnnotation(CoreTypes.OVERRIDE)
      .beginMethodDefinition(GET_TABLE_MAPPING_VISITORS)
      .writeStringStatement("return tableMappingInfo")
      .finishMethodDefinition();
}
origin: com.yahoo.squidb/squidb-processor

private void emitAliasedPropertyArray() throws IOException {
  writer.writeComment("--- aliased property references");
  Expression aliasedPropertiesInit = Expressions.block(new Expression() {
    @Override
    public boolean writeExpression(JavaFileWriter writer) throws IOException {
      return emitPropertyReferenceArrayBody(true);
    }
  }, false, false, false, false);
  writer.writeFieldDeclaration(TypeConstants.PROPERTY_ARRAY, ALIASED_PROPERTY_ARRAY_NAME,
      aliasedPropertiesInit, TypeConstants.PUBLIC_STATIC_FINAL)
      .writeNewline();
  writer.beginInitializerBlock(true, true);
  writer.writeStatement(Expressions.callMethod("validateAliasedProperties", ALIASED_PROPERTY_ARRAY_NAME));
  writer.finishInitializerBlock(false, true);
  writer.writeNewline();
}
origin: com.yahoo.squidb/squidb-processor

@Override
public void emitConstructors(JavaFileWriter writer) throws IOException {
  if (generateConstructors) {
    String valuesName = "contentValues";
    DeclaredTypeName valuesType = TypeConstants.CONTENT_VALUES;
    MethodDeclarationParameters params = new MethodDeclarationParameters()
        .setModifiers(Modifier.PUBLIC)
        .setConstructorName(modelSpec.getGeneratedClassName());
    params.setArgumentTypes(Collections.singletonList(valuesType))
        .setArgumentNames(valuesName);
    writer.beginConstructorDeclaration(params)
        .writeStatement(Expressions.callMethod("this", valuesName,
            ModelFileWriter.PROPERTIES_ARRAY_NAME))
        .finishMethodDefinition();
    String methodName = "readPropertiesFromContentValues";
    params.setArgumentTypes(Arrays.asList(valuesType, TypeConstants.PROPERTY_VARARGS))
        .setArgumentNames(valuesName, "withProperties");
    writer.beginConstructorDeclaration(params)
        .writeStringStatement("this()")
        .writeStringStatement(methodName + "(" + valuesName + ", withProperties)")
        .finishMethodDefinition();
  }
}
com.yahoo.aptutils.writer.expressionsExpressionscallMethod

Popular methods of Expressions

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

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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