当前位置: 首页>>代码示例>>Java>>正文


Java PropertyUtilsBean.copyProperties方法代码示例

本文整理汇总了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;
}
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:23,代码来源:ArtistService.java

示例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;
}
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:27,代码来源:ArtistService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:25,代码来源:RecommendationService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:38,代码来源:AlbumService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:AlbumService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:AlbumService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:35,代码来源:AlbumService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:AlbumService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:AlbumService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:RateService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:RateService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:ArtistService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:13,代码来源:ArtistService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:16,代码来源:RecommendationService.java

示例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;
    }
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:15,代码来源:UserService.java


注:本文中的org.apache.commons.beanutils.PropertyUtilsBean.copyProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。