Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-206

Additional Lang Method Suggestions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • None
    • None
    • Operating System: All
      Platform: All

    • 13771

    Description

      I love Commons/Lang! I've been replacing my own implementations to yours.

      Here are some unique ones that I haven't been able to map yet. Please consider
      adding them to the Commons/Lang component:
      getClassNameOnly( Object o ) : String /** Returns only the final node of the
      class name (ex: return "String" from instance of "java.lang.String"). Useful
      for formatting error messages */
      getNumerics( String s ) : String /** Returns only the numeric contents of s */
      getProperCase( String s ) : String /** Returns proper-case equivalent of the
      contents of s (ex: return "Bob Smith" from "bob smith") */
      getBoolean( String s ) : boolean /** Returns the boolean equivalent of s (ex:
      map boolean equivalents of strings: t/f, true/false, True/False, y/n, Yes/No,
      1/0, On/Off, +/-, Yep/Nope, etc.) */
      getTrueOrFalse( boolean b ) : String /** Returns the equivalent of b as
      either "True" or "False" */ ... other methods to support inverse of previous
      method (ex: getYesOrNo, getOnOrOff, etc.)
      getSqlEscapedColumnValue( String s ) : String /** Returns an SQL-based escaped
      equivalent of s (ex: map "Bob's" to "Bob''s", etc.) */
      getSqlWhereEqualsColumnValueOrIsNull( String s ) : String /** Returns "= '[s]'"
      (if s != null) or "is null" (if s == null) for safely building SQL Where Clause
      Predicates like "ColumnName = 'Bob'" or "ColumnName is null" */
      getSqlColumnValueOrNull( String s ) : String /** Returns s or the String "null"
      such that the returned value can be used to safely build an SQL Update.Set
      Clause, Insert.Values Clause, etc. as "Set Col=[s]" where s is the value
      returned from this method ... Overloads for Date, Integer, ... */

      Not one to drop requests and then jump ship ... I am willing to offer
      implementations of any of these, if needed.

      Thanks!!
      Ken Fitzpatrick

      Attachments

        Activity

          People

            Unassigned Unassigned
            kenfitzpatrick@yahoo.com Ken Fitzpatrick
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: