/*
 * blanco Framework
 * Copyright (C) 2004-2005 IGA Tosiki
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */
package blanco.db.definition;

import java.sql.ResultSetMetaData;
import java.sql.Types;

import blanco.ig.expander.IgType;

/**
 * @author Yasuo Nakanishi
 */
public class AbstractFieldDotNet {
    private int _isNullable = ResultSetMetaData.columnNullableUnknown;

    /**
     * 非NULLであればプリミティブ型なのだがNULLサポートのためにオブジェクトマップしているフィールド。
     */
    private boolean _isObjectMappingForPrimitiveNullSupport = false;

    private int _size = -1;

    private int _precision = -1;

    private int _scale = -1;

    private IgType _javaType = null;

    private String _jdbcName = null;

    /**
     * JDBCから得られたタイプそのもの
     */
    private int _jdbcType = Types.OTHER;

    public AbstractFieldDotNet(final IgType type, final String name) {
        _javaType = type;
        _jdbcName = name;
    }

    public String getJdbcName() {
        return _jdbcName;
    }

    public String getName() {
        String result = _jdbcName;
        return result;
    }

    public IgType getJavaType() {
        return _javaType;
    }

    public int getJdbcType() {
        return _jdbcType;
    }

    public void setJdbcType(final int arg) {
        _jdbcType = arg;
    }

    public final String getTypeFullName() {
        return _javaType.getFullName();
    }

    public final String getTypeName() {
        return _javaType.getName();
    }

    /**
     * @return _isNullable を戻します。
     */
    public int getNullable() {
        return _isNullable;
    }

    /**
     * @param nullable
     *            _isNullable を設定。
     */
    public void setNullable(final int nullable) {
        _isNullable = nullable;
    }

    public boolean getObjectMappingForPrimitiveNullSupport() {
        return _isObjectMappingForPrimitiveNullSupport;
    }

    public void setObjectMappingForPrimitiveNullSupport(final boolean arg) {
        _isObjectMappingForPrimitiveNullSupport = arg;
    }

    /**
     * @return _precision を戻します。
     */
    public int getPrecision() {
        return _precision;
    }

    /**
     * @param _precision
     *            _precision を設定。
     */
    public void setPrecision(final int _precision) {
        this._precision = _precision;
    }

    /**
     * @return _scale を戻します。
     */
    public int getScale() {
        return _scale;
    }

    /**
     * @param _scale
     *            _scale を設定。
     */
    public void setScale(final int _scale) {
        this._scale = _scale;
    }

    /**
     * @return _size を戻します。
     */
    public int getSize() {
        return _size;
    }

    /**
     * @param _size
     *            _size を設定。
     */
    public void setSize(final int _size) {
        this._size = _size;
    }
}