Пример #1
0
 /**
  * ** Create a new instance of the specified class name ** @param className The class name to
  * instantiate ** @return The new instance of the specified class name
  */
 public static Object newInstance(String className)
     throws NoSuchMethodException, ClassNotFoundException, InstantiationException,
         IllegalAccessException {
   if (!StringTools.isBlank(className)) {
     // try {
     return Class.forName(className).newInstance();
     // } catch (InvocationTargetException ite) {
     //    Throwable th = ite.getCause();
     //    if (th == null) { th = ite; }
     //    throw th;
     // }
   } else {
     throw new ClassNotFoundException("Class name is null/blank");
   }
 }
Пример #2
0
  /**
   * ** Apply the specified partial key as a suffix to the key name contained in this RTKey
   * ** @param stSfx Property key suffix ** @return The combine property key from this RTKey and the
   * specified suffix.
   */
  public String suffix(String stSfx) {
    String rtk = this.getName();

    /* adjust suffix */
    String sfx = StringTools.trim(stSfx);
    if (sfx.length() == 0) {
      return rtk;
    }

    /* assemble/return */
    StringBuffer sb = new StringBuffer();
    sb.append(rtk);
    if (!rtk.endsWith(".")) {
      sb.append(".");
    }
    if (sfx.startsWith(".")) {
      sb.append(sfx.substring(1));
    } else {
      sb.append(sfx);
    }
    return sb.toString();
  }
Пример #3
0
 /**
  * ** Returns true if this key name contains an empty String ** @return True if this key name
  * contains an empty String
  */
 public boolean isBlank() {
   return StringTools.isBlank(this.keyName);
 }
Пример #4
0
 /** ** Constructor ** @param key The property name */
 public RTKey(String key) {
   this.keyName = StringTools.trim(key);
 }