001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }