Class AndroidxName


  • public class AndroidxName
    extends java.lang.Object
    Type representing an Android Support Library name. This type contains both the old name and the new name of a class. The type also returns a "default name" that will be changed from the old to new eventually.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String defaultName()
      Returns the com.android.support version of the name.
      boolean isEquals​(java.lang.String strName)
      Compares the current name with the given string
      boolean isEqualsIgnoreCase​(java.lang.String strName)
      Compares the current name with the given string ignoring case sensitivity
      boolean isPrefix​(java.lang.String name)
      Returns if the current name is a prefix of the given name.
      boolean isPrefix​(java.lang.String name, boolean strict)
      Returns if the current name is a prefix of the given name.
      java.lang.String newName()
      Returns the androidx version of the name
      static AndroidxName of​(AndroidxName pkg, java.lang.String simpleClassName)
      Creates a new instance for the given package and class name
      static AndroidxName of​(java.lang.String oldPackageName)
      Creates a new package instance for for the package in the com.android.support
      static AndroidxName of​(java.lang.String oldPackage, java.lang.String simpleClassName)
      Creates a new instance for the package in the com.android.support and class name
      java.lang.String oldName()
      Returns the com.android.support version of the name
      java.lang.String removeFrom​(java.lang.String qualifiedName)
      Removes the current name from the given qualified name.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • of

        @NonNull
        public static AndroidxName of​(@NonNull
                                      java.lang.String oldPackage,
                                      @NonNull
                                      java.lang.String simpleClassName)
        Creates a new instance for the package in the com.android.support and class name
      • of

        @NonNull
        public static AndroidxName of​(@NonNull
                                      AndroidxName pkg,
                                      @NonNull
                                      java.lang.String simpleClassName)
        Creates a new instance for the given package and class name
      • of

        @NonNull
        public static AndroidxName of​(@NonNull
                                      java.lang.String oldPackageName)
        Creates a new package instance for for the package in the com.android.support
      • oldName

        @NonNull
        public java.lang.String oldName()
        Returns the com.android.support version of the name
      • newName

        @NonNull
        public java.lang.String newName()
        Returns the androidx version of the name
      • defaultName

        @NonNull
        public java.lang.String defaultName()
        Returns the com.android.support version of the name. This method will start returning to the androidx once those are the default versions to be added to the project. You should avoid using this method when possible and use oldName() or newName() depending on the dependencies of the module.
      • isPrefix

        public boolean isPrefix​(@Nullable
                                java.lang.String name)
        Returns if the current name is a prefix of the given name.
      • isPrefix

        public boolean isPrefix​(@Nullable
                                java.lang.String name,
                                boolean strict)
        Returns if the current name is a prefix of the given name.
        Parameters:
        name - the name to check
        strict - true if the name needs to be strictly longer than the prefix
      • removeFrom

        public java.lang.String removeFrom​(@NonNull
                                           java.lang.String qualifiedName)
        Removes the current name from the given qualified name.

        For example, if the AndroidxName is "android" and the passed qualifiedName is "android.TestClass", this method, will return "TestClass"

      • isEquals

        public boolean isEquals​(@Nullable
                                java.lang.String strName)
        Compares the current name with the given string
      • isEqualsIgnoreCase

        public boolean isEqualsIgnoreCase​(@Nullable
                                          java.lang.String strName)
        Compares the current name with the given string ignoring case sensitivity
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object