Tabnine Logo
AptUtils.getTypeNameFromTypeMirror
Code IndexAdd Tabnine to your IDE (free)

How to use
getTypeNameFromTypeMirror
method
in
com.yahoo.aptutils.utils.AptUtils

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

origin: yahoo/squidb

  private void writeConstantField(JavaFileWriter writer, DeclaredTypeName containingClassName,
      VariableElement constant) throws IOException {
    JavadocPlugin.writeJavadocFromElement(pluginEnv, writer, constant);
    writer.writeFieldDeclaration(
        utils.getTypeNameFromTypeMirror(constant.asType()),
        constant.getSimpleName().toString(),
        Expressions.staticReference(containingClassName, constant.getSimpleName().toString()),
        TypeConstants.PUBLIC_STATIC_FINAL);
  }
}
origin: yahoo/squidb

private void processVariableElements() {
  for (Element e : modelSpecElement.getEnclosedElements()) {
    if (e instanceof VariableElement && e.getAnnotation(Ignore.class) == null) {
      TypeName typeName = utils.getTypeNameFromTypeMirror(e.asType());
      if (!(typeName instanceof DeclaredTypeName)) {
        utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
            "Element type " + typeName + " is not a concrete type, will be ignored", e);
      } else if (!pluginBundle.processVariableElement((VariableElement) e, (DeclaredTypeName) typeName)) {
        // Deprecated things are generally ignored by plugins, so don't warn about them
        // private static final fields are generally internal model spec constants, so don't warn about them
        if (e.getAnnotation(Deprecated.class) == null &&
            !e.getModifiers().containsAll(TypeConstants.PRIVATE_STATIC_FINAL)) {
          utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
              "No plugin found to handle field", e);
        }
      }
    }
  }
}
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

@Override
public void afterProcessVariableElements() {
  // Look for additional constants in @Constant annotated inner classes
  List<? extends Element> elements = modelSpec.getModelSpecElement().getEnclosedElements();
  for (Element element : elements) {
    if (element instanceof TypeElement && element.getAnnotation(Constants.class) != null) {
      if (!element.getModifiers().containsAll(Arrays.asList(Modifier.PUBLIC, Modifier.STATIC))) {
        utils.getMessager().printMessage(Diagnostic.Kind.WARNING, "@Constants annotated class is not " +
            "public static, will be ignored", element);
        continue;
      }
      TypeElement constantClass = (TypeElement) element;
      List<VariableElement> constantList = new ArrayList<>();
      innerClassConstants.put(constantClass.getSimpleName().toString(), constantList);
      for (Element e : constantClass.getEnclosedElements()) {
        if (e instanceof VariableElement && e.getAnnotation(Ignore.class) == null) {
          TypeName typeName = utils.getTypeNameFromTypeMirror(e.asType());
          if (!(typeName instanceof DeclaredTypeName)) {
            utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
                "Element type " + typeName + " is not a concrete type, will be ignored", e);
          } else {
            processVariableElement((VariableElement) e, constantList);
          }
        }
      }
    }
  }
}
origin: com.yahoo.squidb/squidb-processor

  private void writeConstantField(JavaFileWriter writer, DeclaredTypeName containingClassName,
      VariableElement constant) throws IOException {
    JavadocPlugin.writeJavadocFromElement(pluginEnv, writer, constant);
    writer.writeFieldDeclaration(
        utils.getTypeNameFromTypeMirror(constant.asType()),
        constant.getSimpleName().toString(),
        Expressions.staticReference(containingClassName, constant.getSimpleName().toString()),
        TypeConstants.PUBLIC_STATIC_FINAL);
  }
}
origin: com.yahoo.squidb/squidb-processor

private void processVariableElements() {
  for (Element e : modelSpecElement.getEnclosedElements()) {
    if (e instanceof VariableElement && e.getAnnotation(Ignore.class) == null) {
      TypeName typeName = utils.getTypeNameFromTypeMirror(e.asType());
      if (!(typeName instanceof DeclaredTypeName)) {
        utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
            "Element type " + typeName + " is not a concrete type, will be ignored", e);
      } else if (!pluginBundle.processVariableElement((VariableElement) e, (DeclaredTypeName) typeName)) {
        // Deprecated things are generally ignored by plugins, so don't warn about them
        // private static final fields are generally internal model spec constants, so don't warn about them
        if (e.getAnnotation(Deprecated.class) == null &&
            !e.getModifiers().containsAll(TypeConstants.PRIVATE_STATIC_FINAL)) {
          utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
              "No plugin found to handle field", e);
        }
      }
    }
  }
}
origin: com.yahoo.squidb/squidb-processor

  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: com.yahoo.squidb/squidb-processor

@Override
public void afterProcessVariableElements() {
  // Look for additional constants in @Constant annotated inner classes
  List<? extends Element> elements = modelSpec.getModelSpecElement().getEnclosedElements();
  for (Element element : elements) {
    if (element instanceof TypeElement && element.getAnnotation(Constants.class) != null) {
      if (!element.getModifiers().containsAll(Arrays.asList(Modifier.PUBLIC, Modifier.STATIC))) {
        utils.getMessager().printMessage(Diagnostic.Kind.WARNING, "@Constants annotated class is not " +
            "public static, will be ignored", element);
        continue;
      }
      TypeElement constantClass = (TypeElement) element;
      List<VariableElement> constantList = new ArrayList<>();
      innerClassConstants.put(constantClass.getSimpleName().toString(), constantList);
      for (Element e : constantClass.getEnclosedElements()) {
        if (e instanceof VariableElement && e.getAnnotation(Ignore.class) == null) {
          TypeName typeName = utils.getTypeNameFromTypeMirror(e.asType());
          if (!(typeName instanceof DeclaredTypeName)) {
            utils.getMessager().printMessage(Diagnostic.Kind.WARNING,
                "Element type " + typeName + " is not a concrete type, will be ignored", e);
          } else {
            processVariableElement((VariableElement) e, constantList);
          }
        }
      }
    }
  }
}
com.yahoo.aptutils.utilsAptUtilsgetTypeNameFromTypeMirror

Popular methods of AptUtils

  • getMessager
  • isEmpty
  • <init>
  • accumulateImportsFromElements
  • accumulateImportsFromTypeNames
  • getAnnotationValue
  • getAnnotationValueFromMirror
  • getElements
  • getTypeMirrorsFromAnnotationValue
  • getTypeNamesFromAnnotationValue
  • getTypes
  • getValuesFromAnnotationValue
  • getTypes,
  • getValuesFromAnnotationValue,
  • methodDeclarationParamsFromExecutableElement,
  • newJavaFileWriter

Popular in Java

  • Start an intent from android
  • compareTo (BigDecimal)
  • setContentView (Activity)
  • onCreateOptionsMenu (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Best plugins for Eclipse
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