<commit_before>package com.alexrnl.commons.database;

import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.alexrnl.commons.utils.object.AutoCompare;
import com.alexrnl.commons.utils.object.AutoHashCode;
import com.alexrnl.commons.utils.object.Field;

/**
 * Class representing a column in a entity.<br />
 * It is defined by a name and a type. The columns should be load once and for all to avoid unnecessary
 * duplicates.
 * @author Alex
 */
public class Column implements Serializable {
	/** Logger */
	private static Logger		lg					= Logger.getLogger(Column.class.getName());
	
	/** Serial Version UID */
	private static final long	serialVersionUID	= 7764202331118428284L;
	
	/** The Java type associated to the column */
	private Class<?>			type;
	/** The name (identifier) of the column in the data base */
	private String				name;
	/** <code>true</code> if the column is an index of the table */
	private boolean				isID;
	
	/**
	 * Constructor #1.<br />
	 * Default constructor.
	 */
	public Column () {
		this(null, null);
	}
	
	/**
	 * Constructor #2.<br />
	 * @param type
	 *            the type of the column.
	 * @param name
	 *            the name of the column.
	 * @param isID
	 *            <code>true</code> if the column is an index.
	 */
	public Column (final Class<?> type, final String name, final boolean isID) {
		this.type = type;
		this.name = name;
		this.isID = isID;
		if (lg.isLoggable(Level.FINE)) {
			lg.fine("New " + this.getClass().getCanonicalName() + ": " + this.name + ", type: "
					+ this.type.getName() + (this.isID ? " index" : ""));
		}
	}
	
	/**
	 * Constructor #3.<br />
	 * Build a column which is not an index of the table.
	 * @param type
	 *            the type of the column.
	 * @param name
	 *            the name of the column.
	 */
	public Column (final Class<?> type, final String name) {
		this(type, name, false);
	}
	
	/**
	 * Return the type.
	 * @return the type
	 */
	@Field
	public Class<?> getType () {
		return type;
	}
	
	/**
	 * Set the type.
	 * @param type
	 *            the type to set.
	 */
	public void setType (final Class<?> type) {
		this.type = type;
	}
	
	/**
	 * Return the name.
	 * @return the name.
	 */
	@Field
	public String getName () {
		return name;
	}
	
	/**
	 * Set the name.
	 * @param name
	 *            the name to set.
	 */
	public void setName (final String name) {
		this.name = name;
	}
	
	/**
	 * Return the isID.
	 * @return <code>true</code> if the column is an index of the table.
	 */
	@Field
	public boolean isID () {
		return isID;
	}
	
	/**
	 * Set the isID.
	 * @param isID
	 *            <code>true</code> if the column is an index of the table.
	 */
	public void setID (final boolean isID) {
		this.isID = isID;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override<commit_msg>Making the Column class immutable<commit_after>package com.alexrnl.commons.database;

import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.alexrnl.commons.utils.object.AutoCompare;
import com.alexrnl.commons.utils.object.AutoHashCode;
import com.alexrnl.commons.utils.object.Field;

/**
 * Class representing a column in a entity.<br />
 * It is defined by a name and a type. The columns should be load once and for all to avoid
 * unnecessary duplicates.<br />
 * Instances of this class are immutable.
 * @author Alex
 */
public class Column implements Serializable {
	/** Logger */
	private static Logger		lg					= Logger.getLogger(Column.class.getName());
	
	/** Serial Version UID */
	private static final long	serialVersionUID	= 7764202331118428284L;
	
	/** The Java type associated to the column */
	private final Class<?>		type;
	/** The name (identifier) of the column in the data base */
	private final String		name;
	/** <code>true</code> if the column is an index of the table */
	private final boolean		isID;
	
	/**
	 * Constructor #1.<br />
	 * @param type
	 *            the type of the column.
	 * @param name
	 *            the name of the column.
	 * @param isID
	 *            <code>true</code> if the column is an index.
	 */
	public Column (final Class<?> type, final String name, final boolean isID) {
		this.type = type;
		this.name = name;
		this.isID = isID;
		if (lg.isLoggable(Level.FINE)) {
			lg.fine("New " + this.getClass().getCanonicalName() + ": " + this.name + ", type: "
					+ this.type.getName() + (this.isID ? " index" : ""));
		}
	}
	
	/**
	 * Constructor #2.<br />
	 * Build a column which is not an index of the table.
	 * @param type
	 *            the type of the column.
	 * @param name
	 *            the name of the column.
	 */
	public Column (final Class<?> type, final String name) {
		this(type, name, false);
	}
	
	/**
	 * Return the type.
	 * @return the type
	 */
	@Field
	public Class<?> getType () {
		return type;
	}
	
	/**
	 * Return the name.
	 * @return the name.
	 */
	@Field
	public String getName () {
		return name;
	}
	
	/**
	 * Return the isID.
	 * @return <code>true</code> if the column is an index of the table.
	 */
	@Field
	public boolean isID () {
		return isID;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
{'fraction_non_alphanumeric': 0.13143294432753014, 'fraction_numerical': 0.008226516166060838, 'mean_word_length': 2.5955983493810177, 'pattern_counts': {'":': 2, '<': 34, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4377592', 'n_tokens_mistral': 1847, 'n_tokens_neox': 1663, 'n_words': 553}