Java Class Name Format classToXMLName(Class klass)

Here you can find the source of classToXMLName(Class klass)

Description

class To XML Name

License

Open Source License

Declaration

public static <T> String classToXMLName(Class<T> klass) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <T> String classToXMLName(Class<T> klass) {
        return dasherize(klass.getSimpleName()).toLowerCase();
    }/*from w ww .j  av a  2s.co  m*/

    public static String dasherize(String str) {
        if (str == null)
            return null;

        return str.replaceAll("([A-Z]+)([A-Z][a-z])", "$1-$2").replaceAll("([a-z])([A-Z])", "$1-$2")
                .replaceAll("_", "-").toLowerCase();
    }
}

Related

  1. classToString(Class clazz)
  2. classToString(Class[] array, String separator, String defaultValue)
  3. classToString(Class[] cArr)
  4. classToString(int clasS)
  5. classToStringRepresentation(Class c)