avatar
m*t
2

I can't think of any other generic way except of using reflection
to traverse the member variables. But that's pretty hacky, and
slow as well ...

【在 r*****u 的大作中提到】
: without using Object.clone()?
avatar
m*t
3

BTW, it just occured to me that if you don't care about the color
of the object, then a regular office copier might work very well...

【在 m******t 的大作中提到】
:
: I can't think of any other generic way except of using reflection
: to traverse the member variables. But that's pretty hacky, and
: slow as well ...

avatar
r*u
4
The problem of using reflection is that you can not copy the
private field of the superclass.

【在 m******t 的大作中提到】
:
: BTW, it just occured to me that if you don't care about the color
: of the object, then a regular office copier might work very well...

avatar
m*t
5

maybe this would work?
java.lang.reflect.ReflectPermission

【在 r*****u 的大作中提到】
: The problem of using reflection is that you can not copy the
: private field of the superclass.

avatar
c*t
6
object serialization.

【在 r*****u 的大作中提到】
: without using Object.clone()?
avatar
r*u
7
This only applies to serilizable object, right?
\【 在 coconut (coconut) 的大作中提到: 】
avatar
r*s
8
first, it depends on what "copy" means here. does your "copy" here mean
creating another object without calling its constructor?
generally, if you don't like the generic Object.clone(), why not
override it? You can provide your own way of "copy" in this way.

【在 r*****u 的大作中提到】
: This only applies to serilizable object, right?
: \【 在 coconut (coconut) 的大作中提到: 】

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。