Browse Source

KERNEL-1198 JSON插件第二次提交

pull/19/head
Mars.Ma 5 years ago
parent
commit
852b32943a
  1. 4
      src/main/java/com/fanruan/api/cal/Parameter.java
  2. 8
      src/main/java/com/fanruan/api/cal/ParameterKit.java
  3. 10
      src/main/java/com/fanruan/api/conf/ConfigurationKit.java
  4. 4
      src/main/java/com/fanruan/api/data/AbstractDataModel.java
  5. 4
      src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java
  6. 4
      src/main/java/com/fanruan/api/data/AbstractParameterTableData.java
  7. 21
      src/main/java/com/fanruan/api/net/http/EntityKit.java
  8. 9
      src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java
  9. 10
      src/main/java/com/fanruan/api/util/CodeKit.java
  10. 15
      src/main/java/com/fanruan/api/util/ComparatorKit.java
  11. 16
      src/main/java/com/fanruan/api/xml/XmlKit.java

4
src/main/java/com/fanruan/api/cal/Parameter.java

@ -1,4 +0,0 @@
package com.fanruan.api.cal;
public class Parameter extends com.fr.base.Parameter {
}

8
src/main/java/com/fanruan/api/cal/ParameterKit.java

@ -136,4 +136,12 @@ public class ParameterKit {
return parameters;
}
/**
* 将ParameterProvider转化为Parameter
* @param providers 需要转换的ParameterProvider
* @return 转换后的Parameter
*/
public static Parameter[] providers2Parameter(ParameterProvider[] providers) {
return Parameter.providers2Parameter(providers);
}
}

10
src/main/java/com/fanruan/api/conf/ConfigurationKit.java

@ -1,5 +1,6 @@
package com.fanruan.api.conf;
import com.fr.config.ConfigContext;
import com.fr.config.Configuration;
import com.fr.config.holder.ConfigChangeListener;
import com.fr.transaction.Configurations;
@ -38,4 +39,13 @@ public class ConfigurationKit {
});
}
/**
* 返回config实例且config实例只存在一个
* @param configuration Configuration类
* @param <T>
* @return config实例
*/
public static <T extends Configuration> T getConfigInstance(final Class<T> configuration) {
return ConfigContext.getConfigInstance(configuration);
}
}

4
src/main/java/com/fanruan/api/data/AbstractDataModel.java

@ -0,0 +1,4 @@
package com.fanruan.api.data;
public abstract class AbstractDataModel extends com.fr.data.AbstractDataModel {
}

4
src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java

@ -0,0 +1,4 @@
package com.fanruan.api.data;
public abstract class AbstractDatabaseConnection extends com.fr.data.impl.AbstractDatabaseConnection {
}

4
src/main/java/com/fanruan/api/data/AbstractParameterTableData.java

@ -0,0 +1,4 @@
package com.fanruan.api.data;
public abstract class AbstractParameterTableData extends com.fr.data.AbstractParameterTableData {
}

21
src/main/java/com/fanruan/api/net/http/EntityKit.java

@ -0,0 +1,21 @@
package com.fanruan.api.net.http;
import com.fr.third.org.apache.http.HttpEntity;
import com.fr.third.org.apache.http.ParseException;
import com.fr.third.org.apache.http.util.EntityUtils;
import java.io.IOException;
public class EntityKit {
/**
* 利用defaultCharset字符集将HttpEntity对象转化为String对象
* @param entity 需要转化为String的HttpEntity对象
* @param defaultCharset 传入的字符集
* @return HttpEntity对象转化为的String对象
* @throws IOException
* @throws ParseException
*/
public static String toString(HttpEntity entity, String defaultCharset) throws IOException, ParseException {
return EntityUtils.toString(entity, defaultCharset);
}
}

9
src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java

@ -0,0 +1,9 @@
package com.fanruan.api.net.http.message;
/**
* 键值对类
*/
public class BasicNameValuePair extends com.fr.third.org.apache.http.message.BasicNameValuePair {
public BasicNameValuePair(String name, String value) {
super(name, value);
}
}

10
src/main/java/com/fanruan/api/util/CodeKit.java

@ -12,4 +12,14 @@ public class CodeKit {
public static String passwordDecode(String passwordText) {
return CodeUtils.passwordDecode(passwordText);
}
/**
* 将经过处理的中日韩文字符串解码成原先的中日韩文
* @param text 经过处理的中日韩文字
* @return 中日韩文字
* @throws Exception
*/
public static String cjkDecode(String text) throws Exception {
return CodeUtils.cjkDecode(text);
}
}

15
src/main/java/com/fanruan/api/util/ComparatorKit.java

@ -0,0 +1,15 @@
package com.fanruan.api.util;
import com.fr.general.ComparatorUtils;
public class ComparatorKit {
/**
* 比较两个Object对象是否相等
* @param object1 第一个Object对象
* @param object2 第二个Object对象
* @return 相等返回True 不相等返回False
*/
public static boolean equals(Object object1, Object object2){
return ComparatorUtils.equals(object1, object2);
}
}

16
src/main/java/com/fanruan/api/xml/XmlKit.java

@ -3,11 +3,8 @@ package com.fanruan.api.xml;
import com.fr.data.core.DataCoreXmlUtils;
import com.fr.data.impl.Connection;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import com.fr.stable.ParameterProvider;
import com.fr.stable.xml.*;
import java.io.InputStream;
@ -76,4 +73,13 @@ public class XmlKit {
DataCoreXmlUtils.writeXMLConnection(writer, connection);
}
/**
*读出xml参数
* @param reader xml读出对象
* @return 返回保存参数数组
*/
public static ParameterProvider readParameter(XMLableReader reader) {
return StableXMLUtils.readParameter(reader);
}
}

Loading…
Cancel
Save