Class AnnotationFileUtil


  • public class AnnotationFileUtil
    extends java.lang.Object
    Utility class for annotation files (stub files and ajava files).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @Nullable java.util.List<AnnotationFileResource> allAnnotationFiles​(java.lang.String location, AnnotationFileUtil.AnnotationFileType fileType)
      Return annotation files found at a given file system location (does not look on classpath).
      static boolean isCanonicalConstructor​(javax.lang.model.element.ExecutableElement elt, javax.lang.model.util.Types types)
      Returns true if the given ExecutableElement is the canonical constructor of a record (i.e., the parameter types of the constructor correspond to the parameter types of the record components, ignoring annotations).
      static org.plumelib.util.IPair<@FullyQualifiedName java.lang.String,​java.lang.String> partitionQualifiedName​(java.lang.String imported)
      Split a name (which comes from an import statement) into the part before the last period and the part after the last period.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnnotationFileUtil

        public AnnotationFileUtil()
    • Method Detail

      • partitionQualifiedName

        public static org.plumelib.util.IPair<@FullyQualifiedName java.lang.String,​java.lang.String> partitionQualifiedName​(java.lang.String imported)
        Split a name (which comes from an import statement) into the part before the last period and the part after the last period.
        Parameters:
        imported - the name to split
        Returns:
        a pair of the type name and the field name
      • allAnnotationFiles

        public static @Nullable java.util.List<AnnotationFileResource> allAnnotationFiles​(java.lang.String location,
                                                                                          AnnotationFileUtil.AnnotationFileType fileType)
        Return annotation files found at a given file system location (does not look on classpath).
        Parameters:
        location - an annotation file (stub file or ajava file), a jarfile, or a directory. Look for it as an absolute file and relative to the current directory.
        fileType - file type of files to collect
        Returns:
        annotation files with the given file type found in the file system (does not look on classpath). Returns null if the file system location does not exist; the caller may wish to issue a warning in that case.
      • isCanonicalConstructor

        public static boolean isCanonicalConstructor​(javax.lang.model.element.ExecutableElement elt,
                                                     javax.lang.model.util.Types types)
        Returns true if the given ExecutableElement is the canonical constructor of a record (i.e., the parameter types of the constructor correspond to the parameter types of the record components, ignoring annotations).
        Parameters:
        elt - the constructor/method to check
        types - the Types instance to use for comparing types
        Returns:
        true if elt is the canonical constructor of the record containing it