Build a "nice toString" for an object.

@param clazz class
@param args  arguments
@return a "nice toString" text
974569
public static String toNiceString(final Class<?> clazz, final Object... args) {
        final StringBuilder sb = new StringBuilder();
        sb.append("#");
        sb.append(clazz.getSimpleName());
        sb.append("# |");
        boolean b = true;
        for (final Object arg : args) {
            if (b) {
                sb.append(" ");
                sb.append(arg);
                sb.append(":");
            } else {
                sb.append(" ");
                sb.append(arg);
                sb.append(" |");
            }
            b = !b;
        }
        return sb.toString();
    }
843437
public String _(String key, Object... args) {
//        JellyBuilder b = (JellyBuilder)getDelegate();

        ResourceBundle resourceBundle = getResourceBundle();

        // notify the listener if set
//        InternationalizedStringExpressionListener listener = (InternationalizedStringExpressionListener) Stapler.getCurrentRequest().getAttribute(LISTENER_NAME);
//        if(listener!=null)
//            listener.onUsed(this, args);

        args = Stapler.htmlSafeArguments(args);

        return resourceBundle.format(LocaleProvider.getLocale(), key, args);
    }
1178859
public static String getCommandName(Class<?> clazz) {
    String name = clazz.getName();
    return Strings.uncapitalize(name.substring(name.lastIndexOf('.') + 1));
  }
83338
public static <T> String argsToString(String separator, T... args) {
    StringBuilder sb = new StringBuilder();
    for (T s : args) {
      if (sb.length() != 0) {
        sb.append(separator);
      }
      sb.append(s);
    }
    return sb.toString();
  }
363753
public String build(Class<?> clazz) {
		String packageName = clazz.getPackage().getName();
		String formattedPackageName = packageName.replace(".", "/");
		return formattedPackageName + "/" + clazz.getSimpleName()
				+ "-BeanohContext.xml";
	}
205393
@Override
    protected <T> T getCommand(Class<T> clazz) {
        return getCommand(commands, clazz, this, api, extension);
    }
576580
private boolean canBeMadeFromString(final Class<?> clazz) {
        if (clazz.isEnum()) {
            return true;
        }
        try {
            clazz.getConstructor(String.class);
            return true;
        } catch (final NoSuchMethodException e) {
            return false;
        }
    }
508838
public static String fmtMsg(final String fmt, final int arg) {
    Object[] o = new Object[1];
    o[0] = new Integer(arg);

    return MessageFormat.format(fmt, o);
  }
1094261
public static String readResourceToString(@NotNull Class<?> clazz, @NotNull String resource) {
        try {
            try (Reader r = new BufferedReader(new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8"))) {

                Writer writer = new StringWriter();

                char[] buffer = new char[1024];
                int n;
                while ((n = r.read(buffer)) != -1) {
                    writer.write(buffer, 0, n);
                }

                return writer.toString();
            }
        } catch (IOException ioe) {
            throw new RuntimeException(ioe);
        }
    }
75145
public static String format(String templet, Object... args) {
        return MessageFormat.format(templet, args);
    }
872521
public static String format (Object message, Object... args)
    {
        return new LogBuilder(message, args).toString();
    }
818781
public static <T> String toXml(Class<T> clazz, T object) {
    return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object);
  }
112647
public <T> T toBean(Class<T> clazz) {
		return BeanUtil.mapToBean(this, clazz, false);
	}
304505
public static String simpleASName (Class<?> clazz)
    {
        if (clazz.isArray()) {
            Class<?> compoType = clazz.getComponentType();
            if (Byte.TYPE.equals(compoType)) {
                return "ByteArray";
            } else if (Object.class.equals(compoType)) {
                return "Array";
            } else {
                return "TypedArray /* of " + compoType + " */";
            }
        } else if (clazz == Boolean.TYPE) {
            return "Boolean";
        } else if (clazz == Byte.TYPE || clazz == Character.TYPE ||
                   clazz == Short.TYPE || clazz == Integer.TYPE) {
            return "int";
        } else if (clazz == Long.TYPE) {
            return "Long";
        } else if (clazz == Float.TYPE || clazz == Double.TYPE) {
            return "Number";
        } else {
            String cname = clazz.getName();
            Package pkg = clazz.getPackage();
            int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
            String name = cname.substring(offset);
            return name.replace('$', '_');
        }
    }
299573
public static String classpathFromClass(Class<?> clazz) {
        String aname = clazz.getPackage().getName().replaceAll("\\.", "/") + "/" +  clazz.getSimpleName()+".class";
        String apath = ClassLoader.getSystemClassLoader().getResource( aname).getPath();
        String path = null;
        if (apath.contains("!")) {
            path = apath.substring(0, apath.indexOf("!")).replace("file:", "");
        } else {
            path = apath.substring(0, apath.indexOf(aname));
        }
        return path;
    }
441229
public static String getClassPath(Class clazz){
        CodeSource codeSource = clazz.getProtectionDomain().getCodeSource();
        if(codeSource!=null)
            return URLUtil.toSystemID(codeSource.getLocation());
        else{
            URL url = clazz.getResource(clazz.getSimpleName() + ".class");
            if("jar".equals(url.getProtocol())){
                String path = url.getPath();
                try{
                    return URLUtil.toSystemID(new URL(path.substring(0, path.lastIndexOf('!'))));
                }catch(MalformedURLException ex){
                    throw new ImpossibleException("as per JAR URL Syntax this should never happen", ex);
                }
            }
            String resource = URLUtil.toSystemID(url);
            String relativePath = "/"+clazz.getName().replace(".", FileUtil.SEPARATOR)+".class";
            if(resource.endsWith(relativePath))
                resource = resource.substring(0, resource.length()-relativePath.length());
            return resource;
        }
    }
167826
public static String getDescriptor(final Class<?> clazz) {
    StringBuilder stringBuilder = new StringBuilder();
    appendDescriptor(stringBuilder, clazz);
    return stringBuilder.toString();
  }