001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.dao.orm.hibernate;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    
019    import org.hibernate.PropertyNotFoundException;
020    import org.hibernate.property.DirectPropertyAccessor;
021    import org.hibernate.property.Getter;
022    import org.hibernate.property.Setter;
023    
024    /**
025     * @author Shuyang Zhou
026     */
027    @SuppressWarnings("rawtypes")
028    public class PrivatePropertyAccessor extends DirectPropertyAccessor {
029    
030            @Override
031            public Getter getGetter(Class clazz, String propertyName)
032                    throws PropertyNotFoundException {
033    
034                    propertyName = StringPool.UNDERLINE.concat(propertyName);
035    
036                    return super.getGetter(clazz, propertyName);
037            }
038    
039            @Override
040            public Setter getSetter(Class clazz, String propertyName)
041                    throws PropertyNotFoundException {
042    
043                    propertyName = StringPool.UNDERLINE.concat(propertyName);
044    
045                    return super.getSetter(clazz, propertyName);
046            }
047    
048    }