类 Utils


  • public class Utils
    extends java.lang.Object
    • 构造器概要

      构造器 
      构造器 说明
      Utils()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static java.lang.String capitalize​(java.lang.String name)
      make first word capitalize
      static java.lang.String cleanCommentContent​(java.lang.String content)
      remove some characters like [* \n]
      static void closeSilently​(java.io.Closeable stream)
      close stream
      static java.lang.String decapitalize​(java.lang.String name)
      make first word lower case
      static java.lang.String getActionUrl​(java.lang.String baseUrl, java.lang.String relativeUrl)
      get url with base url
      static java.lang.String getClassName​(java.lang.String packageClass)
      get simple class name
      static java.lang.String getJavaFileName​(java.io.File javaFile)
      get file name without extension
      static java.util.List<java.lang.String> getModuleNames​(java.io.File projectDir)
      get project modules name
      static boolean hasDirInFile​(java.io.File f, java.io.File stopPath, java.lang.String dirName)
      judge dir is in file's path or not
      static boolean isJFinalFramework​(java.io.File javaSrcDir)
      the project is a jfinal framework or not
      static boolean isNotEmpty​(java.lang.String str)
      judge input string is not empty
      static boolean isPlayFramework​(java.io.File projectDir)
      the project is a play framework or not
      static boolean isSpringFramework​(java.io.File javaSrcDir)
      the project is a spring mvc framework or not
      static boolean isValueType​(java.lang.Object value)
      is value type or not
      static java.lang.String joinArrayString​(java.lang.String[] array, java.lang.String separator)
      join string array , ( e.g.
      static <T> T jsonToObject​(java.lang.String json, java.lang.Class<T> type)
      json string to object
      static void mkdirsForFile​(java.io.File file)
      create dirs for file
      static java.lang.String removeQuotations​(java.lang.String rawUrl)
      some parse url may has double quotation, remove them
      static java.lang.String streamToString​(java.io.InputStream in)
      simple read stream to String
      static java.lang.String toJson​(java.lang.Object map)
      object to simple json
      static java.lang.String toPrettyJson​(java.lang.Object map)
      object to pretty json
      static void wideSearchFile​(java.io.File rootPath, java.io.FilenameFilter filter, java.util.List<java.io.File> result, boolean stopAtFirstResult)
      search files match filter, store in result
      static void writeToDisk​(java.io.File f, java.lang.String content)
      write content to file
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • Utils

        public Utils()
    • 方法详细资料

      • toPrettyJson

        public static java.lang.String toPrettyJson​(java.lang.Object map)
        object to pretty json
        参数:
        map -
        返回:
      • toJson

        public static java.lang.String toJson​(java.lang.Object map)
        object to simple json
        参数:
        map -
        返回:
      • jsonToObject

        public static <T> T jsonToObject​(java.lang.String json,
                                         java.lang.Class<T> type)
        json string to object
        类型参数:
        T -
        参数:
        json -
        type -
        返回:
      • writeToDisk

        public static void writeToDisk​(java.io.File f,
                                       java.lang.String content)
                                throws java.io.IOException
        write content to file
        参数:
        f -
        content -
        抛出:
        java.io.IOException
      • closeSilently

        public static void closeSilently​(java.io.Closeable stream)
        close stream
        参数:
        stream -
      • streamToString

        public static java.lang.String streamToString​(java.io.InputStream in)
                                               throws java.io.IOException
        simple read stream to String
        参数:
        in -
        返回:
        抛出:
        java.io.IOException
      • isNotEmpty

        public static boolean isNotEmpty​(java.lang.String str)
        judge input string is not empty
        参数:
        str -
        返回:
      • removeQuotations

        public static java.lang.String removeQuotations​(java.lang.String rawUrl)
        some parse url may has double quotation, remove them
        参数:
        rawUrl -
        返回:
      • cleanCommentContent

        public static java.lang.String cleanCommentContent​(java.lang.String content)
        remove some characters like [* \n]
        参数:
        content -
        返回:
      • getActionUrl

        public static java.lang.String getActionUrl​(java.lang.String baseUrl,
                                                    java.lang.String relativeUrl)
        get url with base url
        参数:
        baseUrl -
        relativeUrl -
        返回:
      • decapitalize

        public static java.lang.String decapitalize​(java.lang.String name)
        make first word lower case
        参数:
        name -
        返回:
      • capitalize

        public static java.lang.String capitalize​(java.lang.String name)
        make first word capitalize
        参数:
        name -
        返回:
      • joinArrayString

        public static java.lang.String joinArrayString​(java.lang.String[] array,
                                                       java.lang.String separator)
        join string array , ( e.g. ([a,a,a] , .) = a.a.a )
        参数:
        array -
        separator -
        返回:
      • getJavaFileName

        public static java.lang.String getJavaFileName​(java.io.File javaFile)
        get file name without extension
        参数:
        javaFile -
        返回:
      • wideSearchFile

        public static void wideSearchFile​(java.io.File rootPath,
                                          java.io.FilenameFilter filter,
                                          java.util.List<java.io.File> result,
                                          boolean stopAtFirstResult)
        search files match filter, store in result
        参数:
        rootPath -
        filter -
        result -
        stopAtFirstResult - stop when first file matches
      • hasDirInFile

        public static boolean hasDirInFile​(java.io.File f,
                                           java.io.File stopPath,
                                           java.lang.String dirName)
        judge dir is in file's path or not
        参数:
        f -
        stopPath - stopPath
        dirName -
        返回:
      • isPlayFramework

        public static boolean isPlayFramework​(java.io.File projectDir)
        the project is a play framework or not
        参数:
        projectDir - 工程目录
        返回:
      • isSpringFramework

        public static boolean isSpringFramework​(java.io.File javaSrcDir)
        the project is a spring mvc framework or not
        参数:
        javaSrcDir -
        返回:
      • isJFinalFramework

        public static boolean isJFinalFramework​(java.io.File javaSrcDir)
        the project is a jfinal framework or not
        参数:
        javaSrcDir -
        返回:
      • isValueType

        public static boolean isValueType​(java.lang.Object value)
        is value type or not
        参数:
        value -
        返回:
      • getClassName

        public static java.lang.String getClassName​(java.lang.String packageClass)
        get simple class name
        参数:
        packageClass -
        返回:
      • getModuleNames

        public static java.util.List<java.lang.String> getModuleNames​(java.io.File projectDir)
        get project modules name
        参数:
        projectDir -
        返回:
      • mkdirsForFile

        public static void mkdirsForFile​(java.io.File file)
        create dirs for file
        参数:
        file -