Codota Logo
com.yahoo.aptutils.utils
Code IndexAdd Codota to your IDE (free)

How to use com.yahoo.aptutils.utils

Best Java code snippets using com.yahoo.aptutils.utils (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: yahoo/squidb

@Override
public void addRequiredImports(Set<DeclaredTypeName> imports) {
  utils.accumulateImportsFromElements(imports, modelMethods);
  utils.accumulateImportsFromElements(imports, staticModelMethods);
}
origin: yahoo/squidb

@Override
public void addRequiredImports(Set<DeclaredTypeName> imports) {
  utils.accumulateImportsFromTypeNames(imports, interfaces);
}
origin: yahoo/squidb

@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
  super.init(processingEnv);
  this.utils = new AptUtils(processingEnv);
}
origin: yahoo/squidb

private void logSingleError(AnnotationValue singleErrorAnnotation) {
  AnnotationMirror singleErrorMirror = (AnnotationMirror) singleErrorAnnotation.getValue();
  TypeMirror errorClass = utils.getTypeMirrorsFromAnnotationValue(
      utils.getAnnotationValueFromMirror(singleErrorMirror, "specClass")).get(0);
  String errorMessage = utils.getValuesFromAnnotationValue(
      utils.getAnnotationValueFromMirror(singleErrorMirror, "message"), String.class).get(0);
  List<String> errorElementValues = utils.getValuesFromAnnotationValue(
      utils.getAnnotationValueFromMirror(singleErrorMirror, "element"), String.class);
  String errorElementName = AptUtils.isEmpty(errorElementValues) ? null : errorElementValues.get(0);
  Element errorElement = findErrorElement(errorClass, errorElementName);
  utils.getMessager().printMessage(Diagnostic.Kind.ERROR, errorMessage, errorElement);
}
origin: yahoo/squidb

/**
 * @return true if the table model is for a virtual table, false otherwise
 */
public boolean isVirtualTable() {
  return !AptUtils.isEmpty(modelSpecAnnotation.virtualModule());
}
origin: yahoo/squidb

@Override
public void beforeEmitClassDeclaration(JavaFileWriter writer) throws IOException {
  String generatedJavadoc = " This class was generated from the model spec at "
      + "{@link " + modelSpec.getModelSpecName() + "}";
  String elementJavadoc = utils.getElements().getDocComment(modelSpec.getModelSpecElement());
  if (!AptUtils.isEmpty(elementJavadoc)) {
    generatedJavadoc = (generatedJavadoc + "\n <br/>\n" + elementJavadoc);
  }
  writer.writeJavadoc(generatedJavadoc);
  writer.writeComment("Generated code -- do not modify!");
}
origin: yahoo/squidb

@Override
public boolean processVariableElement(VariableElement field, DeclaredTypeName fieldType) {
  if (field.getAnnotation(Deprecated.class) != null) {
    return false;
  }
  if (field.getAnnotation(ColumnSpec.class) != null) {
    utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
        "ColumnSpec is ignored outside of table models", field);
  }
  return super.processVariableElement(field, fieldType);
}
origin: yahoo/squidb

@SuppressWarnings("unchecked")
private void logErrors(Element element) {
  AnnotationValue errorsArrayValue = utils.getAnnotationValue(element, ModelGenErrors.class, "value");
  List<? extends AnnotationValue> errorsList = (List<? extends AnnotationValue>) errorsArrayValue.getValue();
  for (AnnotationValue error : errorsList) {
    logSingleError(error);
  }
}
origin: yahoo/squidb

  private Element findErrorElement(TypeMirror errorClass, String elementName) {
    Element errorClassElement = utils.getTypes().asElement(errorClass);
    List<? extends Element> enclosedElements = errorClassElement.getEnclosedElements();
    for (Element e : enclosedElements) {
      if (e.getSimpleName().toString().equals(elementName)) {
        return e;
      }
    }
    return errorClassElement;
  }
}
origin: yahoo/squidb

  private boolean checkFirstArgType(TypeMirror type, DeclaredTypeName generatedClassName) {
    if (type instanceof ErrorType) {
      return true;
    }
    if (!(type instanceof DeclaredType)) {
      return false;
    }

    DeclaredTypeName typeName = (DeclaredTypeName) utils.getTypeNameFromTypeMirror(type);

    return typeName.equals(generatedClassName) || typeName.equals(TypeConstants.ABSTRACT_MODEL);
  }
}
origin: yahoo/squidb

private void initFileWriter() throws IOException {
  if (this.writer == null) {
    this.writer = utils.newJavaFileWriter(modelSpec.getGeneratedClassName(), modelSpec.getModelSpecElement());
  } else {
    throw new IllegalStateException("JavaFileWriter already initialized");
  }
}
origin: yahoo/squidb

  /**
   * Helper method that other plugins can use to copy javadocs from an Element
   */
  public static void writeJavadocFromElement(PluginEnvironment pluginEnv, JavaFileWriter writer, Element element)
      throws IOException {
    if (!pluginEnv.hasSquidbOption(PluginEnvironment.OPTIONS_DISABLE_JAVADOC_COPYING)) {
      writer.writeJavadoc(pluginEnv.getUtils().getElements().getDocComment(element));
    }
  }
}
origin: yahoo/squidb

public static boolean isPrimitiveType(DeclaredTypeName type) {
  return AptUtils.isEmpty(type.getPackageName());
}
origin: yahoo/squidb

@Override
public void addRequiredImports(Set<DeclaredTypeName> imports) {
  utils.accumulateImportsFromElements(imports, constantElements);
  for (List<VariableElement> innerClassConstant : innerClassConstants.values()) {
    utils.accumulateImportsFromElements(imports, innerClassConstant);
  }
}
origin: yahoo/squidb

@Override
public synchronized void init(ProcessingEnvironment env) {
  super.init(env);
  utils = new AptUtils(env);
  pluginEnv = new PluginEnvironment(utils, env.getOptions());
}
origin: yahoo/squidb

private Set<String> parseOptions() {
  Set<String> result = new HashSet<>();
  String optionsString = envOptions.get(OPTIONS_KEY);
  if (!AptUtils.isEmpty(optionsString)) {
    String[] allOptions = optionsString.split(SEPARATOR);
    Collections.addAll(result, allOptions);
  }
  return result;
}
origin: yahoo/squidb

private void initializePluginsFromEnvironment() {
  String pluginsString = envOptions.get(PLUGINS_KEY);
  if (!AptUtils.isEmpty(pluginsString)) {
    String[] allPlugins = pluginsString.split(SEPARATOR);
    for (String plugin : allPlugins) {
      processPlugin(plugin);
    }
  }
}
origin: yahoo/squidb

private String getColumnName(ColumnSpec columnDef) {
  if (columnDef != null && !AptUtils.isEmpty(columnDef.name().trim())) {
    return columnDef.name().trim();
  }
  return camelCasePropertyName;
}
origin: yahoo/squidb

@Override
protected void registerAdditionalImports(Set<DeclaredTypeName> imports) {
  super.registerAdditionalImports(imports);
  imports.add(JSONTypes.JSON_PROPERTY_SUPPORT);
  imports.add(JSONTypes.JSON_PROPERTY);
  if (!AptUtils.isEmpty(fieldType.getTypeArgs())) {
    imports.add(JSONTypes.PARAMETERIZED_TYPE_BUILDER);
  }
  fieldType.accept(new ImportGatheringTypeNameVisitor(), imports);
}
origin: yahoo/squidb

  @Override
  public boolean writeExpression(JavaFileWriter writer) throws IOException {
    writer.appendString("@")
        .appendString(writer.shortenName(MODEL_GEN_ERROR_INNER, false))
        .appendString("(specClass=")
        .appendExpression(Expressions.classObject(errorInfo.errorClass))
        .appendString(", ");
    if (!AptUtils.isEmpty(errorInfo.element)) {
      writer.appendString("element=\"")
          .appendString(errorInfo.element)
          .appendString("\", ");
    }
    writer.appendString("message=\"")
        .appendString(errorInfo.message)
        .appendString("\")");
    return true;
  }
}
com.yahoo.aptutils.utils

Most used classes

  • AptUtils
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now