當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。