Class SourceOrdering

    • Constructor Detail

      • SourceOrdering

        private SourceOrdering()
    • Method Detail

      • getEnclosedElements

        public static com.google.common.collect.ImmutableList<javax.lang.model.element.Element> getEnclosedElements​(javax.lang.model.element.Element element)
      • enclosedBy

        public static com.google.common.collect.Ordering<javax.lang.model.element.Element> enclosedBy​(javax.lang.model.element.Element element)
      • getAllAccessorsProvider

        public static SourceOrdering.AccessorProvider getAllAccessorsProvider​(javax.lang.model.util.Elements elements,
                                                                              javax.lang.model.util.Types types,
                                                                              javax.lang.model.element.TypeElement originatingType)
        While we have SourceOrdering, there's still a problem: We have inheritance hierarchy and we want to have all defined or inherited accessors returned as members of target type, like Elements.getAllMembers(TypeElement), but we need to have them properly and stably sorted. This implementation doesn't try to correctly resolve order for accessors inherited from different supertypes(interfaces), just something that stable and reasonable wrt source ordering without handling complex cases.
        Parameters:
        elements - the elements utility
        types - the types utility
        originatingType - the type to traverse
        Returns:
        provider of all accessors in source order and mapping
      • disambiguateMethods

        private static java.util.List<javax.lang.model.element.ExecutableElement> disambiguateMethods​(java.lang.Iterable<? extends javax.lang.model.element.ExecutableElement> methods)
      • isJavaLangObject

        static boolean isJavaLangObject​(javax.lang.model.element.TypeElement element)