/** * Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. * Imagine you have a class named <samp>'org.hibernate.internal.util.StringHelper'</samp>; calling collapse on that * classname will result in <samp>'o.h.u.StringHelper'<samp>. * * @param name The name to collapse. * * @return The collapsed name. */ public static String collapse(String name) { if ( name == null ) { return null; } int breakPoint = name.lastIndexOf( '.' ); if ( breakPoint < 0 ) { return name; } return collapseQualifier( name.substring( 0, breakPoint ), true ) + name.substring( breakPoint ); // includes last '.' }
/** * Cross between {@link #collapse} and {@link #partiallyUnqualify}. Functions much like {@link #collapse} * except that only the qualifierBase is collapsed. For example, with a base of 'org.hibernate' the name * 'org.hibernate.internal.util.StringHelper' would become 'o.h.util.StringHelper'. * * @param name The (potentially) qualified name. * @param qualifierBase The qualifier base. * * @return The name itself if it does not begin with the qualifierBase, or the properly collapsed form otherwise. */ public static String collapseQualifierBase(String name, String qualifierBase) { if ( name == null || !name.startsWith( qualifierBase ) ) { return collapse( name ); } return collapseQualifier( qualifierBase, true ) + name.substring( qualifierBase.length() ); }
private String determineUniquePrefix() { return StringHelper.collapseQualifier( getClass().getName(), false ).toUpperCase(Locale.ROOT); } }
/** * Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. * Imagine you have a class named <samp>'org.hibernate.internal.util.StringHelper'</samp>; calling collapse on that * classname will result in <samp>'o.h.u.StringHelper'<samp>. * * @param name The name to collapse. * @return The collapsed name. */ public static String collapse(String name) { if ( name == null ) { return null; } int breakPoint = name.lastIndexOf( '.' ); if ( breakPoint < 0 ) { return name; } return collapseQualifier( name.substring( 0, breakPoint ), true ) + name.substring( breakPoint ); // includes last '.' }
/** * Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. * Imagine you have a class named <samp>'org.hibernate.internal.util.StringHelper'</samp>; calling collapse on that * classname will result in <samp>'o.h.u.StringHelper'<samp>. * * @param name The name to collapse. * @return The collapsed name. */ public static String collapse(String name) { if ( name == null ) { return null; } int breakPoint = name.lastIndexOf( '.' ); if ( breakPoint < 0 ) { return name; } return collapseQualifier( name.substring( 0, breakPoint ), true ) + name.substring( breakPoint ); // includes last '.' }
/** * Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. * Imagine you have a class named <samp>'org.hibernate.internal.util.StringHelper'</samp>; calling collapse on that * classname will result in <samp>'o.h.u.StringHelper'<samp>. * * @param name The name to collapse. * * @return The collapsed name. */ public static String collapse(String name) { if ( name == null ) { return null; } int breakPoint = name.lastIndexOf( '.' ); if ( breakPoint < 0 ) { return name; } return collapseQualifier( name.substring( 0, breakPoint ), true ) + name.substring( breakPoint ); // includes last '.' }
/** * Cross between {@link #collapse} and {@link #partiallyUnqualify}. Functions much like {@link #collapse} * except that only the qualifierBase is collapsed. For example, with a base of 'org.hibernate' the name * 'org.hibernate.internal.util.StringHelper' would become 'o.h.util.StringHelper'. * * @param name The (potentially) qualified name. * @param qualifierBase The qualifier base. * * @return The name itself if it does not begin with the qualifierBase, or the properly collapsed form otherwise. */ public static String collapseQualifierBase(String name, String qualifierBase) { if ( name == null || !name.startsWith( qualifierBase ) ) { return collapse( name ); } return collapseQualifier( qualifierBase, true ) + name.substring( qualifierBase.length() ); }
/** * Cross between {@link #collapse} and {@link #partiallyUnqualify}. Functions much like {@link #collapse} * except that only the qualifierBase is collapsed. For example, with a base of 'org.hibernate' the name * 'org.hibernate.internal.util.StringHelper' would become 'o.h.util.StringHelper'. * * @param name The (potentially) qualified name. * @param qualifierBase The qualifier base. * * @return The name itself if it does not begin with the qualifierBase, or the properly collapsed form otherwise. */ public static String collapseQualifierBase(String name, String qualifierBase) { if ( name == null || ! name.startsWith( qualifierBase ) ) { return collapse( name ); } return collapseQualifier( qualifierBase, true ) + name.substring( qualifierBase.length() ); }
/** * Cross between {@link #collapse} and {@link #partiallyUnqualify}. Functions much like {@link #collapse} * except that only the qualifierBase is collapsed. For example, with a base of 'org.hibernate' the name * 'org.hibernate.internal.util.StringHelper' would become 'o.h.util.StringHelper'. * * @param name The (potentially) qualified name. * @param qualifierBase The qualifier base. * * @return The name itself if it does not begin with the qualifierBase, or the properly collapsed form otherwise. */ public static String collapseQualifierBase(String name, String qualifierBase) { if ( name == null || ! name.startsWith( qualifierBase ) ) { return collapse( name ); } return collapseQualifier( qualifierBase, true ) + name.substring( qualifierBase.length() ); }