diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/StringUtils.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/StringUtils.java index c2f86153f0..9d83b72f3d 100644 --- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/StringUtils.java +++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/StringUtils.java @@ -22,6 +22,9 @@ import org.apache.cayenne.project.validation.NameValidationHelper; import org.apache.cayenne.util.Util; +import java.text.SimpleDateFormat; +import java.util.Calendar; + /** * Methods for mangling strings. */ @@ -158,6 +161,41 @@ else if (str.endsWith("y")) { } } + /** + * Converts string to camel case string + * @param aString + * @param upOrDown + * @return camel cased version + */ + public String camelCase(String aString, boolean upOrDown) { + if (aString == null || aString.length() == 0) { + return aString; + } + return Util.underscoredToJava(aString, upOrDown); + } + + /** + * Converts string to lower case + * @param aString + * @return + */ + public String toLowerCase(String aString) { + if (aString == null || aString.length() == 0) { + return aString; + } + return aString.toLowerCase(); + } + + + public String dateAndTimeNow() { + + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd--HH:mm"); + Calendar calendar = Calendar.getInstance(); + return formatter.format( calendar.getTime()); + + + } + /** *
* Strip generic definition from string