Java String Shorten shortenClassName(Class klass)

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

Description

shorten Class Name

License

Apache License

Declaration

public static String shortenClassName(Class klass) 

Method Source Code

//package com.java2s;
/*/*from  ww  w. j  a v a  2 s.  c om*/
 * Copyright 2001-2013 Geert Bevin (gbevin[remove] at uwyn dot com)
 * Licensed under the Apache License, Version 2.0 (the "License")
 */

public class Main {
    public static String shortenClassName(Class klass) {
        return simpleClassName(klass).replace('$', '_').toLowerCase();
    }

    public static String simpleClassName(Class klass) {
        String class_name = klass.getName();
        if (klass.getPackage() != null) {
            class_name = class_name.substring(klass.getPackage().getName().length() + 1);
        }

        return class_name;
    }
}

Related

  1. shorten(String text, int max)
  2. shorten(String text, int size, int mode)
  3. shorten(String[] a, int from, int to)
  4. shortenAddress(String address)
  5. shortenArray(byte[] src, int length)
  6. shortenClassName(Class clazz, int maxLength)
  7. shortenClassName(String cname)
  8. shortenClassName(String str)
  9. shortenComponentLoggerName(String loggerName)