問題タブ [apache-commons-beanutils]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
3 に答える
8340 参照

java - BeanUtils.copyproperties Date プロパティのコピーの問題?

commons-beanutils 1.8.3 と Date プロパティを java.util.Date として使用しています。

ソースを宛先にコピーしようとすると、日付プロパティをコピーできません。

以下は私の以前の問題を示していますが、誰も私に正しい答えを出してくれません。

例として、ソース Bean の私の日付値は Wed May 15 15:46:04 IST 2013 ですが、BeanUtils はこれを宛先にコピーできません...

BeanUtils 日付変換の問題

0 投票する
1 に答える
905 参照

java - Automatically instantiate Objects and set Value for a given Path

I want to set values by a given Path String in a nested Java Object structure. If a collction property dosen't exists the property should get automatically instantiated:

How can I solve this Problem?

0 投票する
1 に答える
8030 参照

java - BeanUtils.copyProperties はディープ クローンを作成しますか?

これをテストするために、私はすぐに次のものを作りました:

これは、印刷Aする代わりに印刷する必要がありますnull。ここで何がうまくいかなかったのですか?プロパティをあるオブジェクトから別のオブジェクトに実際にコピーするにはどうすればよいでしょうか (そして、同じ値を指すようにしないでください)、BeanUtils.copyProperties は最初にディープ コピーを作成しますか?

0 投票する
7 に答える
39369 参照

java - null および特定のプロパティを無視する BeanUtils copyProperties API

SpringBeanUtils.copyProperties()は、Bean のコピー中に特定のプロパティを無視するオプションを提供します。

Apache Commons BeanUtils は同様の機能を提供しますか?

また、Spring の を使用しているときに null 値を無視することは可能ですかBeanUtils.copyProperties()。この機能は Commons BeanUtils で見られます。

Spring の BeanUtils で同じことを達成できますか?

0 投票する
1 に答える
6776 参照

spring - Why it seems impossible to use BeanUtils.copyProperties from a JPA entity to a JAX-B Bean?

We are using JPA Entities to get the database rows and then when we transfer that to the external, we want to use disconnected object (DTO) which are simple beans annotated with JAX-B.

We use a mapper and its code looks like this:

But when the code is running we get an error like this:

Note this is the Spring implementation of the BeanUtils:

And the naming of the properties are identical (with their getter/setter).

  • Anybody knows why the error happens?

  • And how to use a fast way instead just copying properties one by one?

0 投票する
1 に答える
1091 参照

hibernate - Hibernate が管理するオブジェクトをコピーするには?

オブジェクトを別のオブジェクト (そのプロパティ) にコピーしたい。このオブジェクトは Hibernate によって管理され、遅延コレクションがあります。PropertyUtils.copyProperties() は遅延例外をスローします。

何か方法はありますか?

PS:オブジェクトを所有していないため(別のjarファイルにあるため)、オブジェクトのプロキシを解除したくありません