Class KotlinNameUtil


  • public class KotlinNameUtil
    extends java.lang.Object
    Kotlin utility methods to help with Kotlin naming conventions.

    See, for example, https://github.com/JetBrains/kotlin/blob/master/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/JvmAbi.java

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String GET_PREFIX  
      static java.lang.String IS_PREFIX  
      static java.lang.String SET_PREFIX  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generateGetterName​(java.lang.String name)  
      static java.lang.String generateSetterName​(java.lang.String name)  
      static java.lang.String getterNameToPropertyName​(java.lang.String name, boolean stripAfterDollar)
      See propertiesConventionUtil.kt
      static boolean isGetterName​(java.lang.String name)  
      static boolean isSetterName​(java.lang.String name)  
      • Methods inherited from class java.lang.Object

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

      • generateGetterName

        public static java.lang.String generateGetterName​(java.lang.String name)
      • generateSetterName

        public static java.lang.String generateSetterName​(java.lang.String name)
      • isGetterName

        public static boolean isGetterName​(java.lang.String name)
      • isSetterName

        public static boolean isSetterName​(java.lang.String name)
      • getterNameToPropertyName

        public static java.lang.String getterNameToPropertyName​(java.lang.String name,
                                                                boolean stripAfterDollar)
        See propertiesConventionUtil.kt

        For example:

        getMyProperty -> myProperty isProperty -> property isfalse -> isfalse

        Parameters:
        name - the property getter name e.g. getMyProperty
        stripAfterDollar - strip any extra info added by the compiler
        Returns:
        the property name