Java tutorial
/* * [y] hybris Platform * * Copyright (c) 2000-2013 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */ package com.epam.cme.facades.converters.populator; import de.hybris.platform.commercefacades.product.data.ProductData; import de.hybris.platform.commerceservices.search.resultdata.SearchResultValueData; import de.hybris.platform.converters.Populator; import org.springframework.util.Assert; public class SearchProductReviewPopulator implements Populator<SearchResultValueData, ProductData> { protected <T> T getValue(final SearchResultValueData source, final String propertyName) { if (source.getValues() == null) { return null; } // DO NOT REMOVE the cast (T) below, while it should be unnecessary it is required by the // javac compiler return (T) source.getValues().get(propertyName); } @Override public void populate(final SearchResultValueData source, final ProductData target) { Assert.notNull(source, "Parameter source cannot be null."); Assert.notNull(target, "Parameter target cannot be null."); // Pull the values directly from the SearchResult object target.setNumberOfReviews(this.<Integer>getValue(source, "numberOfReviews")); } }