English 中文(简体)
特定序列使用
原标题:Find serialization usage

I m mantaining some application and I have a categorymark as Serializable, but Iire that is not being seriesized where the Serializable.

确保这一点的最佳途径是什么? 能否静态地确定这一点?

增 编

最佳回答

不是直接的。 一般来说,在标语被写到<代码>时,就会出现序列化。 ObjectOutputStream,但这种情况最经常发生在你的法典之外(例如,在你使用的图书馆或你的集装箱内)。 因此,你有两个选择:

  • 动态地界定了这一方法。 因此,你将最终知道该类别是否正在序列化,没有中断任何功能。 但是,你们需要运行这一系统:

    private void writeObject(java.io.ObjectOutputStream out) {
       out.defaultWriteObject();
       log.info("Object of type " + 
          getClass().getName() + " is being serialized");
       // optionally include a stacktrace here, or use a debugger, to see
       // when exactly it happened
    }
    
  • 努力了解你们的客体。 如果它通过网络转移,或储存在临时储存(储存、藏匿),那么它就应当具有空中效力。 否则,很可能不是。

问题回答

我认为,不可能静态地、至少非常困难地确定——你的物体可以是非基因收集的一部分,可以通过思考加以利用等等。

你们可以做的是,将一些伐木/造船编码放在“Resolve()”和“Replace(Replace)”方法的物体上,在物体的序列化/代号化时,这种方法由jvm指。

I m quite sure, that it can t be checked statically, except you don t use external libraries at all (which will not result in serious programs)

也许你正在使用像Hibernate这样的某种方式,在某些情况下需要具有序列性物体,或者你的物体必须通过网络服务或像Corba这样的其他中层设备站发送,因为这里的序列化是暗中进行的(在标有标识时)。

贵阶层的目的是什么?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签