Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added two methods to be more Java Convention like #449

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions cayenne-cgen/src/main/java/org/apache/cayenne/gen/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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());


}

/**
* <p>
* Strip generic definition from string
Expand Down