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

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

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

origin: yahoo/squidb

private Expression getTypeExpression(DeclaredTypeName fieldType) {
  List<? extends TypeName> typeArgs = fieldType.getTypeArgs();
  if (AptUtils.isEmpty(typeArgs)) {
    return Expressions.classObject(fieldType);
  } else {
    List<Expression> parameterizedTypeBuilderArgs = new ArrayList<>();
    parameterizedTypeBuilderArgs.add(Expressions.classObject(fieldType));
    for (TypeName typeArg : typeArgs) {
      // The cast to DeclaredTypeName is safe because we recursively check all type args before constructing
      // an instance of this property generator
      parameterizedTypeBuilderArgs.add(getTypeExpression((DeclaredTypeName) typeArg));
    }
    return Expressions.staticMethod(JSONTypes.PARAMETERIZED_TYPE_BUILDER, "build",
        parameterizedTypeBuilderArgs);
  }
}
origin: yahoo/squidb

@Override
protected void writeGetterBody(JavaFileWriter writer, MethodDeclarationParameters params) throws IOException {
  Expression typeExpression = getTypeExpression(fieldType);
  writer.writeStatement(Expressions.staticMethod(JSONTypes.JSON_PROPERTY_SUPPORT, "getValueFromJSON",
      "this", propertyName, typeExpression).returnExpr());
}
origin: yahoo/squidb

@Override
protected void writeSetterBody(JavaFileWriter writer, MethodDeclarationParameters params) throws IOException {
  Expression typeExpression = getTypeExpression(fieldType);
  writer.writeStatement(Expressions.staticMethod(JSONTypes.JSON_PROPERTY_SUPPORT, "setValueAsJSON",
      "this", propertyName, params.getArgumentNames().get(0), typeExpression));
  writer.writeStringStatement("return this");
}
origin: yahoo/squidb

private Expression constructInitializer(String name, boolean view) {
  if (view) {
    return Expressions.staticMethod(TypeConstants.VIEW, "fromQuery", QUERY_NAME, name,
        Expressions.classObject(modelSpec.getGeneratedClassName()), PROPERTIES_ARRAY_NAME);
  } else {
    return Expressions.callMethodOn(QUERY_NAME, "as", name,
        Expressions.classObject(modelSpec.getGeneratedClassName()), PROPERTIES_ARRAY_NAME);
  }
}
origin: yahoo/squidb

private void emitModelMethod(JavaFileWriter writer, ExecutableElement e, Modifier... modifiers)
    throws IOException {
  MethodDeclarationParameters params = utils.methodDeclarationParamsFromExecutableElement(e, modifiers);
  ModelMethod methodAnnotation = e.getAnnotation(ModelMethod.class);
  List<Object> arguments = new ArrayList<>();
  if (methodAnnotation != null) {
    String name = methodAnnotation.name();
    if (!AptUtils.isEmpty(name)) {
      params.setMethodName(name);
    }
    params.getArgumentTypes().remove(0);
    params.getArgumentNames().remove(0);
    arguments.add(0, "this");
  }
  arguments.addAll(params.getArgumentNames());
  Expression methodCall = Expressions.staticMethod(modelSpec.getModelSpecName(),
      e.getSimpleName().toString(), arguments);
  if (!CoreTypes.VOID.equals(params.getReturnType())) {
    methodCall = methodCall.returnExpr();
  }
  JavadocPlugin.writeJavadocFromElement(pluginEnv, writer, e);
  writer.beginMethodDefinition(params)
      .writeStatement(methodCall)
      .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: com.yahoo.squidb/squidb-processor

private Expression constructInitializer(String name, boolean view) {
  if (view) {
    return Expressions.staticMethod(TypeConstants.VIEW, "fromQuery", QUERY_NAME, name,
        Expressions.classObject(modelSpec.getGeneratedClassName()), PROPERTIES_ARRAY_NAME);
  } else {
    return Expressions.callMethodOn(QUERY_NAME, "as", name,
        Expressions.classObject(modelSpec.getGeneratedClassName()), PROPERTIES_ARRAY_NAME);
  }
}
origin: com.yahoo.squidb/squidb-processor

private void emitModelMethod(JavaFileWriter writer, ExecutableElement e, Modifier... modifiers)
    throws IOException {
  MethodDeclarationParameters params = utils.methodDeclarationParamsFromExecutableElement(e, modifiers);
  ModelMethod methodAnnotation = e.getAnnotation(ModelMethod.class);
  List<Object> arguments = new ArrayList<>();
  if (methodAnnotation != null) {
    String name = methodAnnotation.name();
    if (!AptUtils.isEmpty(name)) {
      params.setMethodName(name);
    }
    params.getArgumentTypes().remove(0);
    params.getArgumentNames().remove(0);
    arguments.add(0, "this");
  }
  arguments.addAll(params.getArgumentNames());
  Expression methodCall = Expressions.staticMethod(modelSpec.getModelSpecName(),
      e.getSimpleName().toString(), arguments);
  if (!CoreTypes.VOID.equals(params.getReturnType())) {
    methodCall = methodCall.returnExpr();
  }
  JavadocPlugin.writeJavadocFromElement(pluginEnv, writer, e);
  writer.beginMethodDefinition(params)
      .writeStatement(methodCall)
      .finishMethodDefinition();
}
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());
}
com.yahoo.aptutils.writer.expressionsExpressionsstaticMethod

Popular methods of Expressions

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

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Github Copilot alternatives
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