Skip to content

Commit

Permalink
mark some methods public, more defensive code
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
  • Loading branch information
ceki committed Feb 24, 2024
1 parent 1e1c2a7 commit 057ab67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ public AggregationType computeAggregationType(String name) {
// return StringUtil.capitalizeFirstLetter(name);
// }

Method findAdderMethod(String name) {
public Method findAdderMethod(String name) {
String propertyName = BeanUtil.toLowerCamelCase(name);
return beanDescription.getAdder(propertyName);
}

Method findSetterMethod(String name) {
public Method findSetterMethod(String name) {
String propertyName = BeanUtil.toLowerCamelCase(name);
return beanDescription.getSetter(propertyName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static private Charset convertToCharset(ContextAware ca, String val) {
}

// returned value may be null and in most cases it is null.
public static Method getValueOfMethod(Class<?> type) {
static public Method getValueOfMethod(Class<?> type) {
try {
return type.getMethod(CoreConstants.VALUE_OF, STRING_CLASS_PARAMETER);
} catch (NoSuchMethodException e) {
Expand All @@ -107,7 +107,7 @@ public static Method getValueOfMethod(Class<?> type) {
}
}

static private boolean followsTheValueOfConvention(Class<?> parameterClass) {
static public boolean followsTheValueOfConvention(Class<?> parameterClass) {
Method valueOfMethod = getValueOfMethod(parameterClass);
if (valueOfMethod == null)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public static boolean isNullOrEmpty(String str) {
return ((str == null) || str.isEmpty());
}


/**
* Returns true if input str is not null nor empty.
*
Expand All @@ -41,9 +40,23 @@ public static boolean notNullNorEmpty(String str) {
}

public static String capitalizeFirstLetter(String name) {
if(isNullOrEmpty(name))
if (isNullOrEmpty(name))
return name;
else

if(name.length() == 1) {
return name.toUpperCase();
} else
return name.substring(0, 1).toUpperCase() + name.substring(1);
}

public static String lowercaseFirstLetter(String name) {
if (isNullOrEmpty(name))
return name;

if(name.length() == 1) {
return name.toLowerCase();
} else
return name.substring(0, 1).toLowerCase() + name.substring(1);
}

}

0 comments on commit 057ab67

Please sign in to comment.