raymond-jgler / java-class-jacksonizer

A tool to bulk annotate existing constructor with given annotations, or to add a default constructor to Java classes if without.
MIT License
3 stars 0 forks source link

[REFACTOR CODE] Change StringUtils.java's Name And Convert All Static Methods Into Instance To For Readability #19

Open raymond-jgler opened 10 months ago

raymond-jgler commented 10 months ago

Issue:

This does not look readable when expected chaining logic demanded on StringUtils' methods

public static String cleanseClassPath(String raw) {
    String resolved = StringUtils
            .stripUntilClassPath(StringUtils
                            .stripDoubleEndedNonAlphaNumeric(StringUtils
                                    .resolveReplaces(raw,
                                            "class ",
                                            "",
                                            ">",
                                            "",
                                            "<",
                                            "", "[", "", "]", "", "[]","")),
                    '.', '$', '_');
    /**
     * Ok by far the fishiest logic for weird class strings here
     */
    if (resolved.contains("L") && resolved.indexOf(".") < resolved.indexOf("L")) {
      return resolved;
    }
    return StringUtils.resolveReplaces(resolved, "L", "");
  }
raymond-jgler commented 10 months ago

Tracking branch is at https://github.com/trgpnt/Java-Class-Annotatable-Constructor-Templater/commits/19-refactor-code-change-stringutilsjavas-name-and-convert-all-static-methods-into-instance-to-for-readability

Blocker : Object's internal stateful data needs a cleaner way to maintain