本文整理汇总了Java中org.apache.commons.beanutils.PropertyUtilsBean.copyProperties方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtilsBean.copyProperties方法的具体用法?Java PropertyUtilsBean.copyProperties怎么用?Java PropertyUtilsBean.copyProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.beanutils.PropertyUtilsBean
的用法示例。
在下文中一共展示了PropertyUtilsBean.copyProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: artistToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private ArtistDto artistToDto(Artist artist) {
ArtistDto artistDto = new ArtistDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(artistDto, artist);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create artist Data Transfer Object", e);
}
String slug = slugService.getSlugForArtist(artist);
artistDto.setSlug(slug);
if (artist.getBeginDate() != null) {
artistDto.setBeginDateDay(artist.getBeginDate().toDate());
}
if (artist.getEndDate() != null) {
artistDto.setEndDateDay(artist.getEndDate().toDate());
}
return artistDto;
}
示例2: dtoToArtist
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private Artist dtoToArtist(ArtistDto artistDto) {
Artist artist = new Artist();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(artist, artistDto);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create Artist from Data Transfer Object", e);
}
if (artistDto.getAlbums() != null) {
List<Album.ShortInfo> albums = artistDto.getAlbums().stream()
.map(this::albumDtoToShortInfo)
.collect(Collectors.toList());
artist.setAlbums(albums);
}
if (artistDto.getBeginDateDay() != null) {
artist.setBeginDate(new ODate(artistDto.getBeginDateDay()));
}
if (artistDto.getEndDateDay() != null) {
artist.setEndDate(new ODate(artistDto.getEndDateDay()));
}
return artist;
}
示例3: albumToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private AlbumDto albumToDto(Album album) {
AlbumDto albumDto = new AlbumDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(albumDto, album);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album Data Transfer Object", e);
}
String slug = slugService.getSlugForAlbum(album);
albumDto.setSlug(slug);
if (album.getArtists() != null && !album.getArtists().isEmpty()) {
List<ArtistDto> artistDtoList = album.getArtists().stream()
.map(this::artistShortInfoToDto)
.collect(toList());
albumDto.setArtistList(artistDtoList);
}
return albumDto;
}
示例4: albumToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private AlbumDto albumToDto(Album album) {
AlbumDto albumDto = new AlbumDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(albumDto, album);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album Data Transfer Object", e);
}
String slug = slugService.getSlugForAlbum(album);
albumDto.setSlug(slug);
if (album.getTrackList() != null && !album.getTrackList().isEmpty()) {
List<TrackDto> trackDtoList = album.getTrackList().stream()
.map(this::trackToDto)
.collect(toList());
albumDto.setTrackList(trackDtoList);
}
if (album.getArtists() != null && !album.getArtists().isEmpty()) {
List<ArtistDto> artistDtoList = album.getArtists().stream()
.map(this::artistShortInfoToDto)
.collect(toList());
albumDto.setArtistList(artistDtoList);
}
if (album.getReleasedDate() != null) {
albumDto.setReleasedDateDay(album.getReleasedDate().toDate());
}
return albumDto;
}
示例5: trackToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private TrackDto trackToDto(Track track) {
TrackDto trackDto = new TrackDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(trackDto, track);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create track Data Transfer Object", e);
}
return trackDto;
}
示例6: dtoToTrack
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private Track dtoToTrack(TrackDto trackDto) {
Track track = new Track();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(track, trackDto);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create track from Data Transfer Object", e);
}
return track;
}
示例7: dtoToAlbum
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private Album dtoToAlbum(AlbumDto albumDto) {
Album album = new Album();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(album, albumDto);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album Data Transfer Object", e);
}
if (albumDto.getTrackList() != null && !albumDto.getTrackList().isEmpty()) {
List<Track> trackList = albumDto.getTrackList().stream()
.map(this::dtoToTrack)
.collect(toList());
album.setTrackList(trackList);
}
if (albumDto.getArtistList() != null && !albumDto.getArtistList().isEmpty()) {
List<Artist.ShortInfo> artistShortInfoList = albumDto.getArtistList().stream()
.map(this::artistDtoToShortInfo)
.collect(toList());
album.setArtists(artistShortInfoList);
}
if (albumDto.getReleasedDateDay() != null) {
album.setReleasedDate(new ODate(albumDto.getReleasedDateDay()));
}
return album;
}
示例8: artistShortInfoToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private ArtistDto artistShortInfoToDto(Artist.ShortInfo artistShortInfo) {
ArtistDto artistDto = new ArtistDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(artistDto, artistShortInfo);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create artist Data Transfer Object", e);
}
return artistDto;
}
示例9: artistDtoToShortInfo
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private Artist.ShortInfo artistDtoToShortInfo(ArtistDto artistDto) {
Artist.ShortInfo artistShortInfo = new Artist.ShortInfo();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(artistShortInfo, artistDto);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album Data Transfer Object", e);
}
return artistShortInfo;
}
示例10: artistRateToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private RateDto artistRateToDto(ArtistRate artistRate) {
RateDto rateDto = new RateDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(rateDto, artistRate);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create artist rate Data Transfer Object", e);
}
return rateDto;
}
示例11: albumRateToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private RateDto albumRateToDto(AlbumRate albumRate) {
RateDto rateDto = new RateDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(rateDto, albumRate);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album rate Data Transfer Object", e);
}
return rateDto;
}
示例12: shortInfoToAlbumDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private AlbumDto shortInfoToAlbumDto(Album.ShortInfo albumShortInfo) {
AlbumDto albumDto = new AlbumDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(albumDto, albumShortInfo);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album Data Transfer Object", e);
}
return albumDto;
}
示例13: albumDtoToShortInfo
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private Album.ShortInfo albumDtoToShortInfo(AlbumDto albumDto) {
Album.ShortInfo albumShortInfo = new Album.ShortInfo();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(albumShortInfo, albumDto);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create album Data Transfer Object", e);
}
return albumShortInfo;
}
示例14: artistToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private ArtistDto artistToDto(Artist artist) {
ArtistDto artistDto = new ArtistDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(artistDto, artist);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create artist Data Transfer Object", e);
}
String slug = slugService.getSlugForArtist(artist);
artistDto.setSlug(slug);
return artistDto;
}
示例15: userToDto
import org.apache.commons.beanutils.PropertyUtilsBean; //导入方法依赖的package包/类
private UserDto userToDto(User user) {
UserDto userDto = new UserDto();
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
try {
propertyUtilsBean.copyProperties(userDto, user);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException("Can not create user Data Transfer Object", e);
}
userDto.setUsername(user.getId());
return userDto;
}