mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-05 18:50:57 -06:00
Added initial version
This commit is contained in:
commit
b452bd670c
13290 changed files with 1178433 additions and 0 deletions
121
Management-Server/src/main/java/ms/system/mysql/SQLColumn.java
Normal file
121
Management-Server/src/main/java/ms/system/mysql/SQLColumn.java
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
package ms.system.mysql;
|
||||
|
||||
/**
|
||||
* Represents a column used in an SQL table.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public final class SQLColumn {
|
||||
|
||||
/**
|
||||
* The name.
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The data type.
|
||||
*/
|
||||
private final Class<?> type;
|
||||
|
||||
/**
|
||||
* If this column should never be updated in the database.
|
||||
*/
|
||||
private final boolean neverUpdate;
|
||||
|
||||
/**
|
||||
* The value.
|
||||
*/
|
||||
private Object value;
|
||||
|
||||
/**
|
||||
* If the column value changed.
|
||||
*/
|
||||
private boolean changed;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SQLColumn} {@code Object}.
|
||||
* @param name The column name.
|
||||
* @param type The data type.
|
||||
*/
|
||||
public SQLColumn(String name, Class<?> type) {
|
||||
this(name, type, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SQLColumn} {@code Object}.
|
||||
* @param name The column name.
|
||||
* @param type The data type.
|
||||
* @param neverUpdate If this column should never be updated in the database.
|
||||
*/
|
||||
public SQLColumn(String name, Class<?> type, boolean neverUpdate) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.neverUpdate = neverUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
* @return The name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the value.
|
||||
* @param value The value.
|
||||
*/
|
||||
public void updateValue(Object value) {
|
||||
this.changed = value != this.value;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
* @return The value.
|
||||
*/
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
this.changed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the changed.
|
||||
* @return The changed.
|
||||
*/
|
||||
public boolean isChanged() {
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the changed.
|
||||
* @param changed The changed to set.
|
||||
*/
|
||||
public void setChanged(boolean changed) {
|
||||
this.changed = changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
* @return The type.
|
||||
*/
|
||||
public Class<?> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the neverUpdate.
|
||||
* @return The neverUpdate.
|
||||
*/
|
||||
public boolean isNeverUpdate() {
|
||||
return neverUpdate;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue