Java Class Name Format classToLDAPName(Class c)

Here you can find the source of classToLDAPName(Class c)

Description

convert a full classname like org.site.module.class to an ldap friendly version by replacing all "."

License

Open Source License

Parameter

Parameter Description
str the name to convert

Declaration

static String classToLDAPName(Class c) 

Method Source Code

//package com.java2s;
/**/*ww w.j  a  v  a  2 s . c  o m*/
 * Project Wonderland
 *
 * Copyright (c) 2004-2009, Sun Microsystems, Inc., All Rights Reserved
 *
 * Redistributions in source code form must reproduce the above
 * copyright and this condition.
 *
 * The contents of this file are subject to the GNU General Public
 * License, Version 2 (the "License"); you may not use this file
 * except in compliance with the License. A copy of the License is
 * available at http://www.opensource.org/licenses/gpl-license.php.
 *
 * Sun designates this particular file as subject to the "Classpath"
 * exception as provided by Sun in the License file that accompanied
 * this code.
 */

public class Main {
    /**
     * convert a full classname like org.site.module.class to an ldap friendly
     * version by replacing all "." with "-", e.g. returns "org-site-module-class"
     * @param str the name to convert
     * @return
     */
    static String classToLDAPName(Class c) {
        return c.getName().replaceAll("\\.", "-");
    }
}

Related

  1. classToAttributeName(Class clazz)
  2. classToFile(String name)
  3. classToFilename(Class clazz)
  4. classToFileName(String str)
  5. classToInstance(String uriClass)
  6. classToPath(Class clazz)
  7. classToPath(String name, boolean resource)
  8. classToResource(String className)
  9. classToResourceKeyPrefix(final Class clazz)