Gson 转map long出现1.490341044E12 ,而int出现1.0
 String json = "{'expiretime1':1490341044000,'expiretime2':18813140601,'cost':1}";
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(json, new TypeToken<Map<String, Object>>() {}.getType());
System.out.println("result:" + resultMap);

运行结果:
result:{expiretime1=1.490341044E12, expiretime2=1.8813140601E10, cost=1.0}
期望结果:
result:{expiretime1=1490341044000, expiretime2=18813140601, cost=1}
怎么解决呢?

1个回答

liyuhaoo
豪赌大赢家 谢谢,你说的这个是序列化成json时候的解决办法,而我的这个是反序列化成map的时候的
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
gson将json格式的字符串转成java对象,json字符串中long怎么转变不会报错?

# gson将json格式的字符串转成java对象,json字符串中long怎么转变不会报错? public static void main(String[] args) { long timel=12323232L; SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time=sdf.format(timel); System.out.println(time);//正常 Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); String obj="[{\"name\":\"caochuankui\",\"time\":"+timel+"}]"; JSONArray objo=new JSONArray(obj); GsonTest gt=gson.fromJson(objo.toString(), GsonTest.class);//报错 System.out.println(gt.getTime()); } } 错误信息如下: 1970-01-01 11:25:23 Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:200) at com.google.gson.Gson.fromJson(Gson.java:810) at com.google.gson.Gson.fromJson(Gson.java:775) at com.google.gson.Gson.fromJson(Gson.java:724) at com.google.gson.Gson.fromJson(Gson.java:696) at com.pagecofig.util.GsonTest.main(GsonTest.java:67) Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:387) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:189) ... 5 more 这要怎么解决,求大神指点

如何使用gson转换map数据为json数组

如题,我从数据库获取两行的字段内容,使用GSON的tojson的方法转换为JSON数据, //获取tplate这一列内容 ResultSet rst = db.query(); while(rst.next()){ resultMap.put(tplate, rst.getString(tplate)); } return (new Gson()).toJson(resultMap); 这是我转换一列数据的代码 但是这样只能转换最后一行的内容为JSON,现在我想把所有行的数据转换为JSON数组要怎么做到呢?,求助各位大神.

ClassNotFoundException: com.google.gson.Gson

Servlet.service() for servlet [ns] in context with path [/EC] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/google/gson/Gson] with root cause java.lang.ClassNotFoundException: com.google.gson.Gson at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at com.ns.controllers.impl.systemDevice.SystemManageImpl.SendDeviceControlOrder(SystemManageImpl.java:307) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)

java上使用Gson转换长数字的字符串时,被当成了数字处理

直接上代码 public static void main(String[] args) { String jsonString="{\"list\":[{\"Arrayname\": \"000292603088\",\"LUNID\": \"09FB\",\"Capacity\": \"134.8681640625\",\"UUID\": \"60000970000292603088533030394642\",\"Mode\": \"vmax\"}," + "{ \"Arrayname\": \"000292603088\",\"LUNID\":\"09EB\",\"Capacity\":\"134.8681640625\",\"UUID\": \"60000970000292603088533030394542\",\"Mode\":\"vmax\"}]}"; Gson gson = new Gson(); Map<String, Object > itemmapMap=gson.fromJson(jsonString, Map.class); String tolist= itemmapMap.get("list").toString(); System.out.println("原始信息:"+tolist); List<Map<String, Object>> listjson =gson.fromJson(tolist, List.class); for (int i = 0; i < listjson.size(); i++) { Map<String, Object> itemMap=new HashMap<String, Object>(); itemMap=listjson.get(i); Map<String, String> insertMap=new HashMap<String, String>(); insertMap.put("lunId", itemMap.get("UUID").toString()); System.out.println("转换成了:"+insertMap.get("lunId")); } } 原始信息:[{Arrayname=000292603088, LUNID=09FB, Capacity=134.8681640625, UUID=60000970000292603088533030394642, Mode=vmax}, {Arrayname=000292603088, LUNID=09EB, Capacity=134.8681640625, UUID=60000970000292603088533030394542, Mode=vmax}] 转换成了:6.00009700002926E31 转换成了:6.00009700002926E31 请大神指点,希望数据变成60000970000292603088533030394542,而不是6.00009700002926E31 请问gson是否能指定字段的转换类型

坐等求救,java用ssh的时候,Gson解析json有外键的时候报错

解析json是用的gson,实体类涉及到三张表三个类,之间的关系是: C表的一个字段是外键,为A表的主键 C表的另一个字段是外键,为B表的主键 转json的时候报如下异常,该怎么做,请具体一点. 这是多对多的关系吧? java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter? at com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:67) at com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:61) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:96) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:60) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.Gson.toJson(Gson.java:593) at com.google.gson.Gson.toJson(Gson.java:572) at com.google.gson.Gson.toJson(Gson.java:527) at com.chebeiyuan.utils.GsonUtil.objectToString(GsonUtil.java:29) at com.chebeiyuan.action.BaseAction.setResultJson(BaseAction.java:136) at com.chebeiyuan.action.BaseAction.setSuccessJson(BaseAction.java:149) at com.chebeiyuan.action.CarTypeAction.getUserCarList(CarTypeAction.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619)

com.google.gson.JsonSyntaxException

我使用的是谷歌提供的gson解析json数据。json数据如下" {"flag":"0","data":{"id":"176","loginName":"18224006722","name":"18224006722","phone":"18224006722","mobile":"18224006722","loginToken":"c4b23c48bcc7a9bf4f4301cfeca4c3d2","isStoreAdm":"1","storeLogo":""},"tcount":0} ";网络方面我使用的是 OkHttpUtils。 使用自定义的 StringCallback() public abstract class LoginCall extends Callback<Login>{ @Override public Login parseNetworkResponse(Response response) throws Exception { String result = response.body().string(); Gson gson=new Gson(); return gson.fromJson(result,Login.class); } } java实体类我使用的是GsonFormat自动生成的而且还序列化了的,结果就是要报这个异常,求解答。 哦哦,我不使用gson解析可以获取到json字符串, java实体类: public class Login implements Serializable{ private String flag; private DataBean data; private int tcount; public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } public DataBean getData() { return data; } public void setData(DataBean data) { this.data = data; } public int getTcount() { return tcount; } public void setTcount(int tcount) { this.tcount = tcount; } public static class DataBean implements Serializable{ private String id; private String loginName; private String name; private String phone; private String mobile; private String loginToken; private String isStoreAdm; private String storeLogo; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLoginName() { return loginName; } public void setLoginName(String loginName) { this.loginName = loginName; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getLoginToken() { return loginToken; } public void setLoginToken(String loginToken) { this.loginToken = loginToken; } public String getIsStoreAdm() { return isStoreAdm; } public void setIsStoreAdm(String isStoreAdm) { this.isStoreAdm = isStoreAdm; } public String getStoreLogo() { return storeLogo; } public void setStoreLogo(String storeLogo) { this.storeLogo = storeLogo; } } 求帮助呀,谢谢大神了。

Android Gson转换问题

import android.R.bool; public class WebServerData { /// <summary> /// 返回数据 /// </summary> public String data; /// <summary> /// 提示消息 /// </summary> public String msg ; /// <summary> /// 是否成功 /// </summary> public bool success ; public String getData() { return data; } public void setData(String data) { this.data = data; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public bool getSuccess() { return success; } public void setSuccess(bool success) { this.success = success; } } 转换: String d = msg.getData().getString("data"); Gson gson = new Gson(); gson.fromJson(d, WebServerData.class); 问题:问什么把对象中bool类型的参数去掉转换成功,有bool类型的就失败?

解析包含null的原始json数组

Json数组: {"userName":null," msgArr":[null],"numrow":0} //String result Gson: new Gson().fromJson(result, MyClass.class); MyClass: public String userName; public int[] msgArr; ... 错误stack: at java.lang.IllegalArgumentException: Primitive array can't take null values. at java.lang.reflect.Array.set(Array.java:406) at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:78) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.Gson.fromJson(Gson.java:803) at com.google.gson.Gson.fromJson(Gson.java:768) at com.google.gson.Gson.fromJson(Gson.java:717) at com.google.gson.Gson.fromJson(Gson.java:689) at com.test.dao.RequestBase.onPostExecute(RequestBase.java:79) 如果不能修改json字符串 "msgArr=[null]",怎么解除这个异常?

在网络请求的时候出现以下报错

遇到了这么个问题,用的Retrofit+rxjava+Okhttp,求解答 ``` Process: com.example.tidus.ristrat, PID: 7166 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tidus.ristrat/com.example.tidus.ristrat.activity.RiskAssessmentActivity}: java.lang.IllegalArgumentException: Unable to create converter for class com.example.tidus.ristrat.bean.RiskAssessmentBean for method IRetrofitServer.doRiskTableListGet at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3260) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7319) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934) Caused by: java.lang.IllegalArgumentException: Unable to create converter for class com.example.tidus.ristrat.bean.RiskAssessmentBean for method IRetrofitServer.doRiskTableListGet at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:755) at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:741) at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:172) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170) at retrofit2.Retrofit$1.invoke(Retrofit.java:147) at java.lang.reflect.Proxy.invoke(Proxy.java:1006) at $Proxy3.doRiskTableListGet(Unknown Source) at com.example.tidus.ristrat.mvp.model.RiskAssessmentModel.getRiskAssessment(RiskAssessmentModel.java:25) at com.example.tidus.ristrat.mvp.presenter.RiskAssessmentPresenter.getRiskAssessment(RiskAssessmentPresenter.java:16) at com.example.tidus.ristrat.activity.RiskAssessmentActivity.initPresenterData(RiskAssessmentActivity.java:183) at com.example.tidus.ristrat.activity.RiskAssessmentActivity.initData(RiskAssessmentActivity.java:158) at com.example.lib_core.base.BaseActivity.onCreate(BaseActivity.java:44) at android.app.Activity.performCreate(Activity.java:7783) at android.app.Activity.performCreate(Activity.java:7772) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235) ... 11 more Caused by: java.lang.SecurityException: Can not make a java.lang.reflect.Method constructor accessible at java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject.java:153) at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:132) at com.google.gson.internal.reflect.PreJava9ReflectionAccessor.makeAccessible(PreJava9ReflectionAccessor.java:31) at com.google.gson.internal.ConstructorConstructor.newDefaultConstructor(ConstructorConstructor.java:103) at com.google.gson.internal.ConstructorConstructor.get(ConstructorConstructor.java:85) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:101) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ArrayTypeAdapter$1.create(ArrayTypeAdapter.java:48) at com.google.gson.Gson.getAdapter(Gson.java:458) 2019-09-04 13:57:04.536 7166-7166/com.example.tidus.ristrat E/AndroidRuntime: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) 2019-09-04 13:57:04.537 7166-7166/com.example.tidus.ristrat E/AndroidRuntime: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at retrofit2.converter.gson.GsonConverterFactory.responseBodyConverter(GsonConverterFactory.java:64) at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:330) at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:313) at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:739) ... 25 more ``` Bean类 ``` package com.example.tidus.ristrat.bean; import android.view.View; import java.io.Serializable; import java.util.List; public class RiskAssessmentBean implements Serializable { private String code; private String message; private String server_code; private ServerParamsBean server_params; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getServer_code() { return server_code; } public void setServer_code(String server_code) { this.server_code = server_code; } public ServerParamsBean getServer_params() { return server_params; } public void setServer_params(ServerParamsBean server_params) { this.server_params = server_params; } public static class ServerParamsBean implements Serializable { private String PATIENT_ID; private Object DOCTOR_NAME; private Object REPORT_CODE; private Object REPORT_ID; private String IN_DEPT_CODE; private String IN_DEPT_NAME; private String PATIENT_NAME; private String BIRTHDAY; private String PATIENT_SEX; private String MEDICAL_REC_NUMBER; private String VISIT_SQ_NO; private String BED_NUMBER; private List<WENJUANNAMEBean> WENJUANNAME; public String getPATIENT_ID() { return PATIENT_ID; } public void setPATIENT_ID(String PATIENT_ID) { this.PATIENT_ID = PATIENT_ID; } public Object getDOCTOR_NAME() { return DOCTOR_NAME; } public void setDOCTOR_NAME(Object DOCTOR_NAME) { this.DOCTOR_NAME = DOCTOR_NAME; } public Object getREPORT_CODE() { return REPORT_CODE; } public void setREPORT_CODE(Object REPORT_CODE) { this.REPORT_CODE = REPORT_CODE; } public Object getREPORT_ID() { return REPORT_ID; } public void setREPORT_ID(Object REPORT_ID) { this.REPORT_ID = REPORT_ID; } public String getIN_DEPT_CODE() { return IN_DEPT_CODE; } public void setIN_DEPT_CODE(String IN_DEPT_CODE) { this.IN_DEPT_CODE = IN_DEPT_CODE; } public String getIN_DEPT_NAME() { return IN_DEPT_NAME; } public void setIN_DEPT_NAME(String IN_DEPT_NAME) { this.IN_DEPT_NAME = IN_DEPT_NAME; } public String getPATIENT_NAME() { return PATIENT_NAME; } public void setPATIENT_NAME(String PATIENT_NAME) { this.PATIENT_NAME = PATIENT_NAME; } public String getBIRTHDAY() { return BIRTHDAY; } public void setBIRTHDAY(String BIRTHDAY) { this.BIRTHDAY = BIRTHDAY; } public String getPATIENT_SEX() { return PATIENT_SEX; } public void setPATIENT_SEX(String PATIENT_SEX) { this.PATIENT_SEX = PATIENT_SEX; } public String getMEDICAL_REC_NUMBER() { return MEDICAL_REC_NUMBER; } public void setMEDICAL_REC_NUMBER(String MEDICAL_REC_NUMBER) { this.MEDICAL_REC_NUMBER = MEDICAL_REC_NUMBER; } public String getVISIT_SQ_NO() { return VISIT_SQ_NO; } public void setVISIT_SQ_NO(String VISIT_SQ_NO) { this.VISIT_SQ_NO = VISIT_SQ_NO; } public String getBED_NUMBER() { return BED_NUMBER; } public void setBED_NUMBER(String BED_NUMBER) { this.BED_NUMBER = BED_NUMBER; } public List<WENJUANNAMEBean> getWENJUANNAME() { return WENJUANNAME; } public void setWENJUANNAME(List<WENJUANNAMEBean> WENJUANNAME) { this.WENJUANNAME = WENJUANNAME; } public static class WENJUANNAMEBean implements Serializable { private int MERCHANT_ID; private int SITE_ID; private int DEPARTMENT; private int FORM_ID; private String FORM_NAME; private int FORM_TYPE; private int FORM_SEQ; private String BUSINESS_CLASS; private List<XUANXIANGBean> XUANXIANG; private boolean che_color; private int form_id; public int getForm_id() { return form_id; } public void setForm_id(int form_id) { this.form_id = form_id; } public boolean isChe_color() { return che_color; } public void setChe_color(boolean che_color) { this.che_color = che_color; } public int getMERCHANT_ID() { return MERCHANT_ID; } public void setMERCHANT_ID(int MERCHANT_ID) { this.MERCHANT_ID = MERCHANT_ID; } public int getSITE_ID() { return SITE_ID; } public void setSITE_ID(int SITE_ID) { this.SITE_ID = SITE_ID; } public int getDEPARTMENT() { return DEPARTMENT; } public void setDEPARTMENT(int DEPARTMENT) { this.DEPARTMENT = DEPARTMENT; } public int getFORM_ID() { return FORM_ID; } public void setFORM_ID(int FORM_ID) { this.FORM_ID = FORM_ID; } public String getFORM_NAME() { return FORM_NAME; } public void setFORM_NAME(String FORM_NAME) { this.FORM_NAME = FORM_NAME; } public int getFORM_TYPE() { return FORM_TYPE; } public void setFORM_TYPE(int FORM_TYPE) { this.FORM_TYPE = FORM_TYPE; } public int getFORM_SEQ() { return FORM_SEQ; } public void setFORM_SEQ(int FORM_SEQ) { this.FORM_SEQ = FORM_SEQ; } public String getBUSINESS_CLASS() { return BUSINESS_CLASS; } public void setBUSINESS_CLASS(String BUSINESS_CLASS) { this.BUSINESS_CLASS = BUSINESS_CLASS; } public List<XUANXIANGBean> getXUANXIANG() { return XUANXIANG; } public void setXUANXIANG(List<XUANXIANGBean> XUANXIANG) { this.XUANXIANG = XUANXIANG; } public static class XUANXIANGBean implements Serializable { private String GROUP_TAB; private int GROUP_TAB_ID; private List<WENJUANBean> WENJUAN; public String getGROUP_TAB() { return GROUP_TAB; } public void setGROUP_TAB(String GROUP_TAB) { this.GROUP_TAB = GROUP_TAB; } public int getGROUP_TAB_ID() { return GROUP_TAB_ID; } public void setGROUP_TAB_ID(int GROUP_TAB_ID) { this.GROUP_TAB_ID = GROUP_TAB_ID; } public List<WENJUANBean> getWENJUAN() { return WENJUAN; } public void setWENJUAN(List<WENJUANBean> WENJUAN) { this.WENJUAN = WENJUAN; } public static class WENJUANBean implements Serializable { private int FACTOR_GROUP_SEQ; private String FACTOR_GROUP_ID; private String FACTOR_GROUP_NAME; private List<SublistBean> sublist; public int getFACTOR_GROUP_SEQ() { return FACTOR_GROUP_SEQ; } public void setFACTOR_GROUP_SEQ(int FACTOR_GROUP_SEQ) { this.FACTOR_GROUP_SEQ = FACTOR_GROUP_SEQ; } public String getFACTOR_GROUP_ID() { return FACTOR_GROUP_ID; } public void setFACTOR_GROUP_ID(String FACTOR_GROUP_ID) { this.FACTOR_GROUP_ID = FACTOR_GROUP_ID; } public String getFACTOR_GROUP_NAME() { return FACTOR_GROUP_NAME; } public void setFACTOR_GROUP_NAME(String FACTOR_GROUP_NAME) { this.FACTOR_GROUP_NAME = FACTOR_GROUP_NAME; } public List<SublistBean> getSublist() { return sublist; } public void setSublist(List<SublistBean> sublist) { this.sublist = sublist; } public static class SublistBean implements Serializable { private int FACTOR_GROUP_ID; private String FACTOR_GROUP_NAME; private String FACTOR_GROUP_DESC; private int FACTOR_GROUP_SEQ; private Object GROUP_SHOW_LAYOUT; private int RISK_FACTOR_ID; private String RISK_FACTOR_NAME; private int SCORE_SHOW_TYPE; private int MUTEX_GROUP; private String isslect; private String ANALYSIS_SOURCE_STR; private String CURRENT_DESC; private List<OptionListBean> optionList; private View shuruValue; private boolean checked; public boolean isChecked() { return checked; } public void setChecked(boolean checked) { this.checked = checked; } public View getShuruValue() { return shuruValue; } public void setShuruValue(View shuruValue) { this.shuruValue = shuruValue; } public int getFACTOR_GROUP_ID() { return FACTOR_GROUP_ID; } public void setFACTOR_GROUP_ID(int FACTOR_GROUP_ID) { this.FACTOR_GROUP_ID = FACTOR_GROUP_ID; } public String getFACTOR_GROUP_NAME() { return FACTOR_GROUP_NAME; } public void setFACTOR_GROUP_NAME(String FACTOR_GROUP_NAME) { this.FACTOR_GROUP_NAME = FACTOR_GROUP_NAME; } public String getFACTOR_GROUP_DESC() { return FACTOR_GROUP_DESC; } public void setFACTOR_GROUP_DESC(String FACTOR_GROUP_DESC) { this.FACTOR_GROUP_DESC = FACTOR_GROUP_DESC; } public int getFACTOR_GROUP_SEQ() { return FACTOR_GROUP_SEQ; } public void setFACTOR_GROUP_SEQ(int FACTOR_GROUP_SEQ) { this.FACTOR_GROUP_SEQ = FACTOR_GROUP_SEQ; } public Object getGROUP_SHOW_LAYOUT() { return GROUP_SHOW_LAYOUT; } public void setGROUP_SHOW_LAYOUT(Object GROUP_SHOW_LAYOUT) { this.GROUP_SHOW_LAYOUT = GROUP_SHOW_LAYOUT; } public int getRISK_FACTOR_ID() { return RISK_FACTOR_ID; } public void setRISK_FACTOR_ID(int RISK_FACTOR_ID) { this.RISK_FACTOR_ID = RISK_FACTOR_ID; } public String getRISK_FACTOR_NAME() { return RISK_FACTOR_NAME; } public void setRISK_FACTOR_NAME(String RISK_FACTOR_NAME) { this.RISK_FACTOR_NAME = RISK_FACTOR_NAME; } public int getSCORE_SHOW_TYPE() { return SCORE_SHOW_TYPE; } public void setSCORE_SHOW_TYPE(int SCORE_SHOW_TYPE) { this.SCORE_SHOW_TYPE = SCORE_SHOW_TYPE; } public int getMUTEX_GROUP() { return MUTEX_GROUP; } public void setMUTEX_GROUP(int MUTEX_GROUP) { this.MUTEX_GROUP = MUTEX_GROUP; } public String getIsslect() { return isslect; } public void setIsslect(String isslect) { this.isslect = isslect; } public String getANALYSIS_SOURCE_STR() { return ANALYSIS_SOURCE_STR; } public void setANALYSIS_SOURCE_STR(String ANALYSIS_SOURCE_STR) { this.ANALYSIS_SOURCE_STR = ANALYSIS_SOURCE_STR; } public String getCURRENT_DESC() { return CURRENT_DESC; } public void setCURRENT_DESC(String CURRENT_DESC) { this.CURRENT_DESC = CURRENT_DESC; } public List<OptionListBean> getOptionList() { return optionList; } public void setOptionList(List<OptionListBean> optionList) { this.optionList = optionList; } public static class OptionListBean implements Serializable { private int RISK_FACTOR_ID; private int FACTOR_OPTION_ID; private String FACTOR_OPTION; private String OPTION_TYPE; private Object VALUE_START; private Object VALUE_END; private Object SEX; private int AGE_BEGIN; private int AGE_END; private int RISK_SCORE; private int CHANGE_FLAG; private Object RISK_SCORE_CHANGE; private int RISK_LEVEL; private Object DISEASE_CODE; private Object BAD_HABITS; private Object BAD_HABITS_DESC; private Object BAD_HABITS_IMPROVE; private boolean itemChecked; public boolean isItemChecked() { return itemChecked; } public void setItemChecked(boolean itemChecked) { this.itemChecked = itemChecked; } public int getRISK_FACTOR_ID() { return RISK_FACTOR_ID; } public void setRISK_FACTOR_ID(int RISK_FACTOR_ID) { this.RISK_FACTOR_ID = RISK_FACTOR_ID; } public int getFACTOR_OPTION_ID() { return FACTOR_OPTION_ID; } public void setFACTOR_OPTION_ID(int FACTOR_OPTION_ID) { this.FACTOR_OPTION_ID = FACTOR_OPTION_ID; } public String getFACTOR_OPTION() { return FACTOR_OPTION; } public void setFACTOR_OPTION(String FACTOR_OPTION) { this.FACTOR_OPTION = FACTOR_OPTION; } public String getOPTION_TYPE() { return OPTION_TYPE; } public void setOPTION_TYPE(String OPTION_TYPE) { this.OPTION_TYPE = OPTION_TYPE; } public Object getVALUE_START() { return VALUE_START; } public void setVALUE_START(Object VALUE_START) { this.VALUE_START = VALUE_START; } public Object getVALUE_END() { return VALUE_END; } public void setVALUE_END(Object VALUE_END) { this.VALUE_END = VALUE_END; } public Object getSEX() { return SEX; } public void setSEX(Object SEX) { this.SEX = SEX; } public int getAGE_BEGIN() { return AGE_BEGIN; } public void setAGE_BEGIN(int AGE_BEGIN) { this.AGE_BEGIN = AGE_BEGIN; } public int getAGE_END() { return AGE_END; } public void setAGE_END(int AGE_END) { this.AGE_END = AGE_END; } public int getRISK_SCORE() { return RISK_SCORE; } public void setRISK_SCORE(int RISK_SCORE) { this.RISK_SCORE = RISK_SCORE; } public int getCHANGE_FLAG() { return CHANGE_FLAG; } public void setCHANGE_FLAG(int CHANGE_FLAG) { this.CHANGE_FLAG = CHANGE_FLAG; } public Object getRISK_SCORE_CHANGE() { return RISK_SCORE_CHANGE; } public void setRISK_SCORE_CHANGE(Object RISK_SCORE_CHANGE) { this.RISK_SCORE_CHANGE = RISK_SCORE_CHANGE; } public int getRISK_LEVEL() { return RISK_LEVEL; } public void setRISK_LEVEL(int RISK_LEVEL) { this.RISK_LEVEL = RISK_LEVEL; } public Object getDISEASE_CODE() { return DISEASE_CODE; } public void setDISEASE_CODE(Object DISEASE_CODE) { this.DISEASE_CODE = DISEASE_CODE; } public Object getBAD_HABITS() { return BAD_HABITS; } public void setBAD_HABITS(Object BAD_HABITS) { this.BAD_HABITS = BAD_HABITS; } public Object getBAD_HABITS_DESC() { return BAD_HABITS_DESC; } public void setBAD_HABITS_DESC(Object BAD_HABITS_DESC) { this.BAD_HABITS_DESC = BAD_HABITS_DESC; } public Object getBAD_HABITS_IMPROVE() { return BAD_HABITS_IMPROVE; } public void setBAD_HABITS_IMPROVE(Object BAD_HABITS_IMPROVE) { this.BAD_HABITS_IMPROVE = BAD_HABITS_IMPROVE; } } } } } } } } ``` 网络请求的时候 doRiskTableListGet()这个方法报错 ``` public class RiskAssessmentModel implements IRiskAssessmentContart.IRiskAssessmentModel { @SuppressLint("CheckResult") @Override public void getRiskAssessment(HashMap<String, Object> params, final IRequestCallback iRequestCallback) { RetrofitUtils.getInstance().createService(IRetrofitServer.class) .doRiskTableListGet(ApiService.RISK_TABLE_LIST, params) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<RiskAssessmentBean>() { @Override public void accept(RiskAssessmentBean riskAssessmentBean) throws Exception { if (iRequestCallback != null) { iRequestCallback.onSuccess(riskAssessmentBean); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { if (iRequestCallback != null) { iRequestCallback.onFailed(throwable); } } }); } ``` 这是我进到doRiskTableListGet()方法内的代码 ``` @GET Observable<RiskAssessmentBean> doRiskTableListGet(@Url String apiUrl, @QueryMap HashMap<String, Object> params); ```

Gson解析Json数据出现了异常

在用Gson解析如下Json的时候 String jsonStr = "{code:403,msg:无查询好友信息,result:[]}"; 解析代码为: Gson son = new Gson(); MessageInfo info = son.fromJson(jsonStr, MessageInfo.class); System.out.println(info.getCode()); System.out.println(info.getResult()); System.out.println(info.getMsg()); MessageInfo.java private int code; private String msg; private Result result; result为空的时候,就会出现异常 com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 31 望大神帮下忙,解决下,这个怎么来解析

Gson对象转换成字符串出现异常情况

# public static class FileInfo { public long fileSize; public String decryptKey;//解密密钥 public String simpleFileName;//上传到服务器的文件的名称(加密后的文件名) public String displayName;//原文件的名称,加密之前的文件名 public String localPath; public int width, height; } 下面是使用Gson库将FileInfo对象转换成字符串的结果: {"height":1280, "width":720, "decryptKey":"1508143916876HMKNW17629026174", "displayName":"1508143916673.jpg", "fild7e1dcc1d1615,!9/calPath":"\/data\/user\/0\/com.mxspt.dnp\/cache\/2495145", "simpleFileName":"6C313090C042894183C3A493F3E7236A"} 正常结果应该是fielSize:文件大小 和 localPath:路径,结果fileSize和localPath都不完整了。 场景是:一次发送了多张图片,每发送一张生成一个这样的字符串。

gson转换字符型的日期 date问题

前端传的"yyyy-MM-dd HH:mm:ss" 格式的字符串 ,后台转换不了:org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: The date should be a string value; nested exception is com.google.gson.JsonParseException: The date should be a string value 后台数据date传到前端 转换成 "yyyy-MM-dd HH:mm:ss" ,但是前端"yyyy-MM-dd HH:mm:ss"传到后端 gson解析不了 。 但是 前端传这种格式就能解析转成date :"2018-08-22T02:44:09.647Z"

GSON解析 json转java对象问题

使用Gson将JSONObject objectObj 对象转换为Charge对象部分代码: Gson gs = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); Charge charge = gs.fromJson(objectObj.toString(), Charge.class); 问题是结果charge与objectObj结构一致但是某些字段的值不一样了!!! 详见截图,及截图中的标记信息,请大神们提供解决方案: ![图片说明](https://img-ask.csdn.net/upload/201512/07/1449492576_337791.png)

renren-fast 框架集成云通讯短信sdk Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.google.gson.JsonParser.parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement;

renren-fast 框架,使用了云通讯的短信sdk后,调用短信发送,报错这个,不知道怎么处理 短信sdk https://doc.yuntongxun.com/p/5e1595e4d8130bd800fdb327 org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.google.gson.JsonParser.parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement; at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at io.renren.common.xss.XssFilter.doFilter(XssFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:141) at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:82) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

gson.internal.LinkedTreeMap如何转化成javabean对象?

我有一个基础的数据类型(所有服务器返回的数据都是这个格式,只是data类型不同而已) ``` public class BaseDataEntity{ private String result; private String msg; private Object data; public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } } ``` 我在Gson解析完返回数据中想要这样使用: ``` mData = (BaseDataEntity) msg.obj;//这个可以正常转换 UserEntity entity = (UserEntity) mData.getData(); ``` 可是这时候便会报出com.google.gson.internal.LinkedTreeMap无法转换成UserEntity这个类的错误,我想问一下有什么方法可以解决吗?

gson默认将int型转换成double型怎么解决?

android中gson解析的数据库id如:1;2;3;会变成1.0;2.0;3.0;每个int型都会变成double型,这个应该怎么解决?

arcgis-android:100.0.0依赖gson.2.3.1.jar失败,是什么原因呢?

很无语的一个问题。 依赖'com.esri.arcgisruntime:arcgis-android:100.0.0'同步时报出“Error:Failed to resolve: com.google.code.gson:gson:2.3.1”。 clean project之后又报出: Error:A problem occurred configuring project ':app'.> Could not resolve all dependencies for configuration ':app:_debugApkCopy'. > Could not resolve com.google.code.gson:gson:2.3.1. Required by: project :app > com.esri.arcgisruntime:arcgis-android:100.0.0 > Could not resolve com.google.code.gson:gson:2.3.1. > Could not get resource 'https://jcenter.bintray.com/com/google/code/gson/gson/2.3.1/gson-2.3.1.pom'. > Could not HEAD 'https://jcenter.bintray.com/com/google/code/gson/gson/2.3.1/gson-2.3.1.pom'. > Server sent an unsupported extension: type_35 很尴尬啊,找了很久不知道什么问题。 在线依赖“com.esri.arcgisruntime:arcgis-android:100.0.0”,更可怕直接卡在下download arcgis-android-100.0.0.aar上面。(一直开着VPN) 按照官网文档和网上大神的经验配置离线: 1、本地配置maven,并将arcgis-android-100.0.0.aar和arcgis-android-100.0.0.pom放入在C:\Users\Administrator\.m2\repository\com\esri\arcgis\android\arcgis-android\100.0.0和C:\Users\Administrator\.m2\repository\com\esri\arcgisruntime\arcgis-android\100.0.0(因为不知道哪个对,索性就配置了两个)。 2、so文件放在了src/main/jinLibs文件夹下,并在build.gradle配置了。 3、arcgis-android-api.jar和gson-2.3.1.jar放在libs下并依赖。 4、project下的build.gradle也配置了本地仓库。 ![![图片说明](https://img-ask.csdn.net/upload/201706/04/1496572186_730793.png)图片说明](https://img-ask.csdn.net/upload/201706/04/1496572169_652169.png)

坐等求救,java用ssh的时候,Gson解析json有外键的时候报错

java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter? com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:73) com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:69) com.google.gson.TypeAdapter$1.write(TypeAdapter.java:191) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:95) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97) com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61) com.google.gson.Gson.toJson(Gson.java:669) com.google.gson.Gson.toJson(Gson.java:648) com.google.gson.Gson.toJson(Gson.java:603) com.google.gson.Gson.toJson(Gson.java:583) com.gx.lyf.other.controls.NoticeAction.text(NoticeAction.java:96) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

求大神帮我com.google.gson.stream.MalformedJsonException

我别的界面用的解析方法都是一样的,别的界面的数据就是能解析出来,但是这个界面总是出现![图片说明](https://img-ask.csdn.net/upload/201607/29/1469756038_409519.png)![图片说明](https://img-ask.csdn.net/upload/201607/29/1469756049_973899.png)这个问题,但是那个JSON的格式又没有错,这问题已经卡了好几天了,望大神帮我解决一下,万分感谢

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

立即提问
相关内容推荐