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

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

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

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

@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

protected void writePropertiesInitializationBlock() throws IOException {
  for (int i = 0; i < modelSpec.getPropertyGenerators().size(); i++) {
    writer.writeStatement(Expressions
        .assign(Expressions.arrayReference(PROPERTIES_ARRAY_NAME, i),
            Expressions.fromString(modelSpec.getPropertyGenerators().get(i).getPropertyName())));
  }
}
origin: yahoo/squidb

@Override
public void afterEmitPropertyDeclaration(JavaFileWriter writer, PropertyGenerator propertyGenerator)
    throws IOException {
  if (propertyGenerator instanceof RowidPropertyGenerator) {
    if (((TableModelSpecWrapper) modelSpec).isVirtualTable()) {
      writer.writeAnnotation(CoreTypes.DEPRECATED);
      writer.writeFieldDeclaration(TypeConstants.LONG_PROPERTY,
          DEFAULT_ID_PROPERTY_NAME,
          Expressions.fromString(DEFAULT_ROWID_PROPERTY_NAME),
          TypeConstants.PUBLIC_STATIC_FINAL);
    }
    writeRowidSupportMethods(writer, propertyGenerator.getPropertyName());
  }
}
origin: yahoo/squidb

private void emitSqlTableDeclaration(boolean view) throws IOException {
  writer.writeComment("--- " + (view ? "view" : "subquery") + " declaration");
  String name = "\"" + modelSpec.getSpecAnnotation().viewName().trim() + "\"";
  if (modelSpec.getQueryElement() != null) {
    Expression queryReference = Expressions.staticReference(modelSpec.getModelSpecName(),
        modelSpec.getQueryElement().getSimpleName().toString())
        .callMethod("selectMore", ALIASED_PROPERTY_ARRAY_NAME);
    if (modelSpec.getViewQueryAnnotation().freeze()) {
      queryReference = queryReference.callMethod("freeze");
    }
    writer.writeFieldDeclaration(TypeConstants.QUERY, QUERY_NAME, queryReference,
        TypeConstants.PUBLIC_STATIC_FINAL);
    Expression initializer = constructInitializer(name, view);
    writer.writeFieldDeclaration(view ? TypeConstants.VIEW : TypeConstants.SUBQUERY_TABLE,
        view ? VIEW_NAME : SUBQUERY_NAME, initializer, TypeConstants.PUBLIC_STATIC_FINAL);
  } else {
    writer.writeFieldDeclaration(CoreTypes.JAVA_STRING, view ? "VIEW_NAME" : "SUBQUERY_NAME",
        Expressions.fromString(name), TypeConstants.PUBLIC_STATIC_FINAL);
  }
  writer.writeNewline();
}
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: 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

protected void writePropertiesInitializationBlock() throws IOException {
  for (int i = 0; i < modelSpec.getPropertyGenerators().size(); i++) {
    writer.writeStatement(Expressions
        .assign(Expressions.arrayReference(PROPERTIES_ARRAY_NAME, i),
            Expressions.fromString(modelSpec.getPropertyGenerators().get(i).getPropertyName())));
  }
}
origin: com.yahoo.squidb/squidb-processor

@Override
public void afterEmitPropertyDeclaration(JavaFileWriter writer, PropertyGenerator propertyGenerator)
    throws IOException {
  if (propertyGenerator instanceof RowidPropertyGenerator) {
    if (((TableModelSpecWrapper) modelSpec).isVirtualTable()) {
      writer.writeAnnotation(CoreTypes.DEPRECATED);
      writer.writeFieldDeclaration(TypeConstants.LONG_PROPERTY,
          DEFAULT_ID_PROPERTY_NAME,
          Expressions.fromString(DEFAULT_ROWID_PROPERTY_NAME),
          TypeConstants.PUBLIC_STATIC_FINAL);
    }
    writeRowidSupportMethods(writer, propertyGenerator.getPropertyName());
  }
}
origin: com.yahoo.squidb/squidb-processor

private void emitSqlTableDeclaration(boolean view) throws IOException {
  writer.writeComment("--- " + (view ? "view" : "subquery") + " declaration");
  String name = "\"" + modelSpec.getSpecAnnotation().viewName().trim() + "\"";
  if (modelSpec.getQueryElement() != null) {
    Expression queryReference = Expressions.staticReference(modelSpec.getModelSpecName(),
        modelSpec.getQueryElement().getSimpleName().toString())
        .callMethod("selectMore", ALIASED_PROPERTY_ARRAY_NAME);
    if (modelSpec.getViewQueryAnnotation().freeze()) {
      queryReference = queryReference.callMethod("freeze");
    }
    writer.writeFieldDeclaration(TypeConstants.QUERY, QUERY_NAME, queryReference,
        TypeConstants.PUBLIC_STATIC_FINAL);
    Expression initializer = constructInitializer(name, view);
    writer.writeFieldDeclaration(view ? TypeConstants.VIEW : TypeConstants.SUBQUERY_TABLE,
        view ? VIEW_NAME : SUBQUERY_NAME, initializer, TypeConstants.PUBLIC_STATIC_FINAL);
  } else {
    writer.writeFieldDeclaration(CoreTypes.JAVA_STRING, view ? "VIEW_NAME" : "SUBQUERY_NAME",
        Expressions.fromString(name), TypeConstants.PUBLIC_STATIC_FINAL);
  }
  writer.writeNewline();
}
com.yahoo.aptutils.writer.expressionsExpressionsfromString

Popular methods of Expressions

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

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • findViewById (Activity)
  • setContentView (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top 12 Jupyter Notebook extensions
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