Package org.dmlite.util.text

Examples of org.dmlite.util.text.TextHandler


        Object[] args = new Object[1];
        args[0] = paramValue;
        returnObject = method.invoke(object, args);
        // errors.add("Method name: " + method.getName());
      } catch (InvocationTargetException e) {
        TextHandler textExtractor = new TextHandler();
        errors.add("Method " + methodName + " cannot be invoked: "
            + e.getMessage());
        String classSimpleName = textExtractor
            .extractClassSimpleName(clas.getName());
        errors.add("Object class: " + classSimpleName);
        // errors.add("Object class: " + clas.getSimpleName()); // 1.5
        errors.add("Object: " + object);
        errors.add("Method name: " + method.getName());
        String paramClassSimpleName = textExtractor
            .extractClassSimpleName(paramClass.getName());
        errors.add("Param class: " + paramClassSimpleName);
        // errors.add("Param class: " + paramClass.getSimpleName()); //
        // 1.5
        errors.add("Param: " + paramValue);
View Full Code Here


    Collection<PropertyConfig> c = this.getCollection();
    log.info("*** " + title + " ***");
    for (IEntity config : c) {
      PropertyConfig propertyConfig = (PropertyConfig) config;
      String className = propertyConfig.getClass().getName();
      TextHandler textExtractor = new TextHandler();
      String classSimpleName = textExtractor
          .extractClassSimpleName(className);
      propertyConfig.output(classSimpleName);
    }
  }
View Full Code Here

            "displayText");
      }

      Class propertyClass = propertyConfig.getPropertyClassObject();
      String propertyCode = propertyConfig.getCode();
      TextHandler textExtractor = new TextHandler();
      Object property = entity.getProperty(propertyCode);
      String link;
      String linkDisplayText;
      if (entity != null) {
        if (propertyClass == URL.class) {
          URL url = (URL) property;
          if (url == null) {
            link = "";
          } else {
            link = url.toString();
          }
          if (displayText == null) {
            linkDisplayText = textExtractor
                .extractBeginPlusThreeDots(link,
                    App.SHORT_TEXT_LENGTH);
          } else {
            linkDisplayText = displayText;
          }
          externalLink = new ExternalLink("propertyValue", link,
              linkDisplayText);
          add(externalLink);
        } else if (propertyClass == Email.class) {
          Email email = (Email) property;
          if (email == null) {
            link = "";
          } else {
            link = email.toString();
          }
          if (displayText == null) {
            linkDisplayText = textExtractor
                .extractBeginPlusThreeDots(link,
                    App.SHORT_TEXT_LENGTH);
          } else {
            linkDisplayText = displayText;
          }
          externalLink = new ExternalLink("propertyValue", "mailto: " + link,
              linkDisplayText);
          add(externalLink);
        } else if (propertyClass == String.class) {
          link = (String) property;
          if (link == null) {
            link = "";
          }
          if (propertyConfig.getValidationType()
              .equals("java.net.URL")) {
            if (displayText == null) {
              linkDisplayText = textExtractor
                  .extractBeginPlusThreeDots(link,
                      App.SHORT_TEXT_LENGTH);
            } else {
              linkDisplayText = displayText;
            }
            externalLink = new ExternalLink("propertyValue", link,
                linkDisplayText);
            add(externalLink);
          } else if (propertyConfig.getValidationType().equals(
              "org.dmlite.type.email.Email")) {
            if (displayText == null) {
              linkDisplayText = textExtractor
                  .extractBeginPlusThreeDots(link,
                      App.SHORT_TEXT_LENGTH);
            } else {
              linkDisplayText = displayText;
            }
View Full Code Here

        Object[] args = new Object[1];
        args[0] = paramValue;
        returnObject = method.invoke(object, args);
        // errors.add("Method name: " + method.getName());
      } catch (InvocationTargetException e) {
        TextHandler textExtractor = new TextHandler();
        errors.add("Method " + methodName + " cannot be invoked: "
            + e.getMessage());
        String classSimpleName = textExtractor
            .extractClassSimpleName(clas.getName());
        errors.add("Object class: " + classSimpleName);
        // errors.add("Object class: " + clas.getSimpleName()); // 1.5
        errors.add("Object: " + object);
        errors.add("Method name: " + method.getName());
        String paramClassSimpleName = textExtractor
            .extractClassSimpleName(paramClass.getName());
        errors.add("Param class: " + paramClassSimpleName);
        // errors.add("Param class: " + paramClass.getSimpleName()); //
        // 1.5
        errors.add("Param: " + paramValue);
View Full Code Here

      Field[] fields = claz.getDeclaredFields();
      fieldsMap = new HashMap<String, String>();
      for (int i = 0; i < fields.length; i++) {
        Field field = fields[i];
        String fieldName = field.getName();
        TextHandler textHandler = new TextHandler();
        String cFieldName = textHandler.firstLetterToUpper(fieldName);
        fieldsMap.put(fieldName, cFieldName);
      }
    } catch (NullPointerException e) {
      errors.add("Class is null. ");
    }
View Full Code Here

   * @param fieldValue
   *            field value
   */
  public static void setField(Object object, String fieldName,
      Object fieldValue) {
    TextHandler textHandler = new TextHandler();
    String setFieldName = "set" + textHandler.firstLetterToUpper(fieldName);
    Reflector.executeMethod(object, setFieldName, fieldValue);
  }
View Full Code Here

   * @param fieldClassObject
   *            field class object
   */
  public static void setFieldWithNull(Object object, String fieldName,
      Class fieldClassObject) {
    TextHandler textHandler = new TextHandler();
    String setFieldName = "set" + textHandler.firstLetterToUpper(fieldName);
    Reflector.executeMethodWithNull(object, setFieldName, fieldClassObject);
  }
View Full Code Here

   *            field name
   * @return object field
   */
  public static Object getField(Object object, String fieldName) {
    Object field = null;
    TextHandler textHandler = new TextHandler();
    String getFieldName = "get" + textHandler.firstLetterToUpper(fieldName);
    field = Reflector.executeMethod(object, getFieldName);
    return field;
  }
View Full Code Here

   *            persistence type
   * @return persistent model context
   */
  public IPersistentModelContext createModelContext(String packagePrefix,
      String persistenceType) {
    TextHandler textHandler = new TextHandler();
    String appShortName = textHandler.dropBegin(packagePrefix, ".");
    String appShortNameFirstCapitalLetter = textHandler
        .firstLetterToUpper(appShortName);
    String modelContextClassName = packagePrefix + ".model.";
    if (persistenceType.equalsIgnoreCase("xml")) {
      modelContextClassName = modelContextClassName + "xml."
          + appShortNameFirstCapitalLetter + "XmlContext";
View Full Code Here

    Collection<NeighborConfig> c = this.getCollection();
    log.info("*** " + title + " ***");
    for (NeighborConfig config : c) {
      NeighborConfig neighborConfig = (NeighborConfig) config;
      String className = neighborConfig.getClass().getName();
      TextHandler textExtractor = new TextHandler();
      String classSimpleName = textExtractor
          .extractClassSimpleName(className);
      neighborConfig.output(classSimpleName);
    }
  }
View Full Code Here

TOP

Related Classes of org.dmlite.util.text.TextHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.