forked from fanruan/finekit
Browse Source
* 'master' of https://cloud.finedevelop.com/scm/~zhaojunzhe/finekit: http API以及单元测试补充master
zjz1993
5 years ago
10 changed files with 190 additions and 32 deletions
@ -0,0 +1,37 @@
|
||||
package com.fanruan.api.cal; |
||||
|
||||
import com.fr.general.FArray; |
||||
import com.fr.stable.ArrayProvider; |
||||
|
||||
import java.util.Collection; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-29 |
||||
* 创建容器的工具类 |
||||
*/ |
||||
public class ContainerKit { |
||||
|
||||
/** |
||||
* 创建一个插件可识别的数组对象 |
||||
* |
||||
* @param array 原始数组 |
||||
* @param <T> 数组元素类型 |
||||
* @return 插件可识别的数组对象 |
||||
*/ |
||||
public static <T> ArrayProvider<T> newArray(T[] array) { |
||||
return new FArray<>(array); |
||||
} |
||||
|
||||
/** |
||||
* 创建一个插件可识别的数组对象 |
||||
* |
||||
* @param collection 原始集合 |
||||
* @param <T> 数组元素类型 |
||||
* @return 插件可识别的数组对象 |
||||
*/ |
||||
public static <T> ArrayProvider<T> newArray(Collection<T> collection) { |
||||
return new FArray<>(collection); |
||||
} |
||||
} |
@ -1,22 +0,0 @@
|
||||
package com.fanruan.api.consts; |
||||
import com.fr.stable.EncodeConstants; |
||||
|
||||
public class EncodeConstantsKit { |
||||
|
||||
public static final String ENCODING_UTF_8 = EncodeConstants.ENCODING_UTF_8; |
||||
|
||||
public static final String ENCODING_GBK = EncodeConstants.ENCODING_GBK; |
||||
|
||||
public static final String ENCODING_BIG5 = EncodeConstants.ENCODING_BIG5; |
||||
|
||||
public static final String ENCODING_ISO_8859_1 = EncodeConstants.ENCODING_ISO_8859_1; |
||||
|
||||
|
||||
public static final String ENCODING_UTF_16 = EncodeConstants.ENCODING_UTF_16; |
||||
|
||||
public static final String ENCODING_EUC_JP = EncodeConstants.ENCODING_EUC_JP; |
||||
|
||||
public static final String ENCODING_EUC_KR = EncodeConstants.ENCODING_EUC_KR; |
||||
|
||||
public static final String ENCODING_CP850 = EncodeConstants.ENCODING_CP850; |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fanruan.api.macro; |
||||
|
||||
|
||||
/** |
||||
* 编码常量 |
||||
*/ |
||||
public interface EncodeConstants { |
||||
|
||||
/** |
||||
* utf-8编码 |
||||
*/ |
||||
String ENCODING_UTF_8 = com.fr.stable.EncodeConstants.ENCODING_UTF_8; |
||||
|
||||
/** |
||||
* gbk编码 |
||||
*/ |
||||
String ENCODING_GBK = com.fr.stable.EncodeConstants.ENCODING_GBK; |
||||
|
||||
/** |
||||
* big5编码,一般用于繁体中文 |
||||
*/ |
||||
String ENCODING_BIG5 = com.fr.stable.EncodeConstants.ENCODING_BIG5; |
||||
|
||||
/** |
||||
* ios-8859-1编码 |
||||
*/ |
||||
String ENCODING_ISO_8859_1 = com.fr.stable.EncodeConstants.ENCODING_ISO_8859_1; |
||||
|
||||
/** |
||||
* utf16编码 |
||||
*/ |
||||
String ENCODING_UTF_16 = com.fr.stable.EncodeConstants.ENCODING_UTF_16; |
||||
|
||||
/** |
||||
* euc-jp编码 |
||||
*/ |
||||
String ENCODING_EUC_JP = com.fr.stable.EncodeConstants.ENCODING_EUC_JP; |
||||
|
||||
/** |
||||
* euc-kr编码 |
||||
*/ |
||||
String ENCODING_EUC_KR = com.fr.stable.EncodeConstants.ENCODING_EUC_KR; |
||||
|
||||
/** |
||||
* cp850编码 |
||||
*/ |
||||
String ENCODING_CP850 = com.fr.stable.EncodeConstants.ENCODING_CP850; |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fanruan.api.cal; |
||||
|
||||
import com.fr.stable.ArrayProvider; |
||||
import com.fr.third.guava.collect.Lists; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-29 |
||||
*/ |
||||
public class ContainerKitTest { |
||||
|
||||
@Test |
||||
public void newArray() { |
||||
|
||||
ArrayProvider<String> array = ContainerKit.newArray(new String[]{"abc", "xyz"}); |
||||
Assert.assertEquals("xyz", array.elementAt(1)); |
||||
|
||||
ArrayProvider<String> array2 = ContainerKit.newArray(Lists.newArrayList("abc", "xyz")); |
||||
Assert.assertEquals("abc", array2.elementAt(0)); |
||||
} |
||||
} |
Loading…
Reference in new issue