Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
further wrote javadoc
  • Loading branch information
Rkyzzy committed Apr 24, 2021
commit 0fcbdfab03aa9bcb8e0a35dc7276f327a34e7aca
23 changes: 15 additions & 8 deletions APIJSONORM/src/main/java/apijson/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ public static String getString(Object[] array, boolean ignoreEmptyItem) {
public static String getString(Object[] array, String split) {
return getString(array, split, false);
}
//CS304 Issue link: https://github.com/Tencent/APIJSON/issues/182
/**获取string,为null则返回""
* @param array
* @param split
* @param ignoreEmptyItem
* @return
* @param array -the str array given
* @param split -the token used to split
* @param ignoreEmptyItem -whether to ignore empty item or not
* @return {@link #getString(Object[], String, boolean)}
* <p>Here we replace the simple "+" way of concatenating with Stringbuilder 's append</p>
*/
public static String getString(Object[] array, String split, boolean ignoreEmptyItem) {
StringBuilder s = new StringBuilder("");
Expand Down Expand Up @@ -530,10 +532,13 @@ public static String getNumber(CharSequence cs) {
public static String getNumber(String s) {
return getNumber(s, false);
}

//CS304 Issue link: https://github.com/Tencent/APIJSON/issues/182
/**去掉string内所有非数字类型字符
* @param s
* @param s -string passed in
* @param onlyStart 中间有非数字时只获取前面的数字
* @return
* @return limit String
* <p>Here we replace the simple "+" way of concatenating with Stringbuilder 's append</p>
*/
public static String getNumber(String s, boolean onlyStart) {
if (isNotEmpty(s, true) == false) {
Expand Down Expand Up @@ -631,10 +636,12 @@ public static String getCorrectEmail(String email) {
public static String getPrice(String price) {
return getPrice(price, PRICE_FORMAT_DEFAULT);
}
//CS304 Issue link: https://github.com/Tencent/APIJSON/issues/182
/**获取价格,保留两位小数
* @param price
* @param price -price passed in
* @param formatType 添加单位(元)
* @return
* @return limit String
* <p>Here we replace the simple "+" way of concatenating with Stringbuilder 's append</p>
*/
public static String getPrice(String price, int formatType) {
if (isNotEmpty(price, true) == false) {
Expand Down
4 changes: 3 additions & 1 deletion APIJSONORM/src/main/java/apijson/orm/AbstractParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,11 @@ public synchronized void putQueryResult(String path, Object result) {
queryResultMap.put(path, result);
// }
}
//CS304 Issue link: https://github.com/Tencent/APIJSON/issues/48
/**根据路径获取值
* @param valuePath
* @param valuePath -the path need to get value
* @return parent == null ? valuePath : parent.get(keys[keys.length - 1])
* <p>use entrySet+getValue() to replace keySet+get() to enhance efficiency</p>
*/
@Override
public Object getValueByPath(String valuePath) {
Expand Down
14 changes: 9 additions & 5 deletions APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1329,10 +1329,12 @@ public AbstractSQLConfig setCombine(Map<String, List<String>> combine) {
public Object getWhere(String key) {
return getWhere(key, false);
}
//CS304 Issue link: https://github.com/Tencent/APIJSON/issues/48
/**
* @param key
* @param exactMatch
* @param key - the key passed in
* @param exactMatch - whether it is exact match
* @return
* <p>use entrySet+getValue() to replace keySet+get() to enhance efficiency</p>
*/
@JSONField(serialize = false)
@Override
Expand Down Expand Up @@ -2273,11 +2275,13 @@ public static JSONArray newJSONArray(Object obj) {
public String getSetString() throws Exception {
return getSetString(getMethod(), getContent(), ! isTest());
}
//CS304 Issue link: https://github.com/Tencent/APIJSON/issues/48
/**获取SET
* @param method
* @param content
* @param method -the method used
* @param content -the content map
* @return
* @throws Exception
* @throws Exception
* <p>use entrySet+getValue() to replace keySet+get() to enhance efficiency</p>
*/
@JSONField(serialize = false)
public String getSetString(RequestMethod method, Map<String, Object> content, boolean verifyName) throws Exception {
Expand Down