${database.allClassCopyright}package ${glPackagePluginBuri};

import org.apache.commons.beanutils.converters.LongConverter;
import org.escafe.buri.dataaccess.impl.ScriptDataAccessUtilLongKeyImpl;
import org.escafe.buri.oouo.internal.structure.BuriDataFieldType;
import org.seasar.dbflute.helper.beans.DfBeanDesc;
import org.seasar.dbflute.helper.beans.DfPropertyDesc;
import org.seasar.dbflute.helper.beans.factory.DfBeanDescFactory;

/**
 * @author ${database.classAuthor}
 */
public class ${glFixedScriptDataAccessUtilKeyImpl} extends ScriptDataAccessUtilLongKeyImpl {

    // ===================================================================================
    //                                                                          Definition
    //                                                                          ==========
    protected static final LongConverter _converter = new LongConverter(new Long(0));

    // ===================================================================================
    //                                                                         Constructor
    //                                                                         ===========
    public ${glFixedScriptDataAccessUtilKeyImpl}(BuriDataFieldType fieldType) {
        super(fieldType);
    }

    // ===================================================================================
    //                                                                            Override
    //                                                                            ========
    /**
     * Override for allowing not Long type.
     * @param target The target entity. (NotNull)
     * @param prop The property of primary key. (NotNull)
     * @return The The value of primary key as Long type. (NotNull)
     */
    @Override
    protected Long getLongPkey(Object target, String prop) {
        DfBeanDesc beanDesc = DfBeanDescFactory.getBeanDesc(target.getClass());
        DfPropertyDesc pkeyPropertyDesc = beanDesc.getPropertyDesc(prop);
        Object result = pkeyPropertyDesc.getValue(target);
        return (Long) _converter.convert(Long.class, result);
    }
}
