- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.GlobalObject<Integer,T>
-
- com.aoindustries.aoserv.client.GlobalObjectIntegerKey<Type>
-
- com.aoindustries.aoserv.client.schema.Type
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable
public final class Type extends GlobalObjectIntegerKey<Type>
- Author:
- AO Industries, Inc.
- See Also:
Column.getType(com.aoindustries.aoserv.client.AOServConnector)
-
-
Field Summary
Fields Modifier and Type Field Description static intACCOUNTINGstatic intBIG_DECIMALstatic intBOOLEANstatic intDATETODO: UnmodifiableDatestatic StringDATE_namestatic TimeZoneDATE_TIME_ZONEThe time zone used for allto/from String conversions.DATEstatic intDECIMAL_2static intDECIMAL_3static intDOMAIN_LABELstatic intDOMAIN_LABELSstatic intDOMAIN_NAMEstatic intDOUBLEstatic intEMAILstatic intFIREWALLD_ZONE_NAMEstatic intFKEYstatic intFLOATstatic intGECOSstatic intGROUP_IDstatic intHASHED_KEYstatic intHASHED_PASSWORDstatic intHOSTNAMEstatic intIDENTIFIERstatic intINTstatic intINTERVALstatic intIP_ADDRESSstatic intLINUX_IDstatic intLINUX_USERNAMEstatic intLONGstatic intMAC_ADDRESSstatic longMILLIS_PER_DAYThe number of milliseconds in a day.static intMONEYstatic intMYSQL_DATABASE_NAMEstatic intMYSQL_SERVER_NAMEstatic intMYSQL_TABLE_NAMEstatic intMYSQL_USERNAMEstatic intNET_PORTstatic intOCTAL_LONGstatic intPATHstatic intPHONEstatic intPKEYstatic intPOSTGRES_DATABASE_NAMEstatic intPOSTGRES_SERVER_NAMEstatic intPOSTGRES_USERNAMEstatic intSHORTstatic intSMALL_IDENTIFIERstatic intSTRINGstatic intTIMEstatic intURLstatic intUSERNAMEstatic intZONE-
Fields inherited from class com.aoindustries.aoserv.client.GlobalObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description Type()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanalignRight()static booleanalignRight(int id)Objectcast(AOServConnector conn, Object value, Type castToType)Casts one type of object to another.intcompareTo(Object value1, Object value2)static intcompareTo(Object value1, Object value2, int id)Compares two values lexicographically.protected ObjectgetColumnImpl(int i)static longgetDaysFromMillis(long time)Gets the number of days from epoch in GMT.intgetId()AoservProtocolgetLastVersion(AOServConnector connector)StringgetLastVersion_version()intgetMaxPrecision()Gets the maximum precision for this type or-1when unbounded.static intgetMaxPrecision(int type)Gets the maximum precision for the given type or-1when unbounded.static longgetMillisFromDays(long days)Gets the number of milliseconds from epoch in GMT.StringgetName()intgetPrecision(Object value)static intgetPrecision(Object value, int type)AoservProtocolgetSinceVersion(AOServConnector connector)StringgetSinceVersion_version()StringgetString(Object value, int precision)static StringgetString(Object value, int precision, int type)Table.TableIDgetTableID()voidinit(ResultSet result)Initializes this object from the raw database contents.ObjectparseString(String S)static ObjectparseString(String S, int id)voidread(StreamableInput in, AoservProtocol.Version protocolVersion)static longroundToDate(long time)Rounds the time to an exact day in GMT.booleansupportsPrecision()Checks if this type supports any precisions other than default-1.static booleansupportsPrecision(int type)Checks if the given type supports any precisions other than default-1.StringtoStringImpl()AOServObject.toString()implementation that is allowed to throw exceptions.voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.GlobalObjectIntegerKey
equals, getKey, getPkey, hashCode
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
DATE_TIME_ZONE
public static final TimeZone DATE_TIME_ZONE
The time zone used for allto/from String conversions. Is "GMT" and is not expected to change, but all date-based parsing, formatting, conversions, comparisons, or filters should use this constant as the time zone.DATE
-
DATE_name
public static final String DATE_name
- See Also:
- Constant Field Values
-
ACCOUNTING
public static final int ACCOUNTING
- See Also:
Account.Name, Constant Field Values
-
BOOLEAN
public static final int BOOLEAN
- See Also:
Boolean, Constant Field Values
-
DATE
public static final int DATE
TODO: UnmodifiableDate- See Also:
Date, Constant Field Values
-
DECIMAL_2
public static final int DECIMAL_2
- See Also:
BigDecimal, Constant Field Values
-
DECIMAL_3
public static final int DECIMAL_3
- See Also:
BigDecimal, Constant Field Values
-
DOUBLE
public static final int DOUBLE
- See Also:
Double, Constant Field Values
-
EMAIL
public static final int EMAIL
- See Also:
Email, Constant Field Values
-
FKEY
public static final int FKEY
- See Also:
Integer, Constant Field Values
-
FLOAT
public static final int FLOAT
- See Also:
Float, Constant Field Values
-
HOSTNAME
public static final int HOSTNAME
- See Also:
HostAddress, Constant Field Values
-
INT
public static final int INT
- See Also:
Integer, Constant Field Values
-
INTERVAL
public static final int INTERVAL
- See Also:
Long, Constant Field Values
-
IP_ADDRESS
public static final int IP_ADDRESS
- See Also:
InetAddress, Constant Field Values
-
LONG
public static final int LONG
- See Also:
Long, Constant Field Values
-
OCTAL_LONG
public static final int OCTAL_LONG
- See Also:
Long, Constant Field Values
-
PKEY
public static final int PKEY
- See Also:
Integer, Constant Field Values
-
PATH
public static final int PATH
- See Also:
PosixPath, Constant Field Values
-
PHONE
public static final int PHONE
- See Also:
String, Constant Field Values
-
SHORT
public static final int SHORT
- See Also:
Short, Constant Field Values
-
STRING
public static final int STRING
- See Also:
String, Constant Field Values
-
TIME
public static final int TIME
- See Also:
UnmodifiableTimestamp, Constant Field Values
-
URL
public static final int URL
- See Also:
URL, Constant Field Values
-
USERNAME
public static final int USERNAME
- See Also:
User.Name, Constant Field Values
-
ZONE
public static final int ZONE
- See Also:
String, Constant Field Values
-
BIG_DECIMAL
public static final int BIG_DECIMAL
- See Also:
BigDecimal, Constant Field Values
-
DOMAIN_LABEL
public static final int DOMAIN_LABEL
- See Also:
DomainLabel, Constant Field Values
-
DOMAIN_LABELS
public static final int DOMAIN_LABELS
- See Also:
DomainLabels, Constant Field Values
-
DOMAIN_NAME
public static final int DOMAIN_NAME
- See Also:
DomainName, Constant Field Values
-
GECOS
public static final int GECOS
- See Also:
User.Gecos, Constant Field Values
-
GROUP_ID
public static final int GROUP_ID
- See Also:
Group.Name, Constant Field Values
-
HASHED_PASSWORD
public static final int HASHED_PASSWORD
- See Also:
HashedPassword, Constant Field Values
-
LINUX_ID
public static final int LINUX_ID
- See Also:
LinuxId, Constant Field Values
-
MAC_ADDRESS
public static final int MAC_ADDRESS
- See Also:
MacAddress, Constant Field Values
-
MONEY
public static final int MONEY
- See Also:
Money, Constant Field Values
-
MYSQL_DATABASE_NAME
public static final int MYSQL_DATABASE_NAME
- See Also:
Database.Name, Constant Field Values
-
MYSQL_SERVER_NAME
public static final int MYSQL_SERVER_NAME
- See Also:
Server.Name, Constant Field Values
-
MYSQL_TABLE_NAME
public static final int MYSQL_TABLE_NAME
- See Also:
Table_Name, Constant Field Values
-
MYSQL_USERNAME
public static final int MYSQL_USERNAME
- See Also:
User.Name, Constant Field Values
-
NET_PORT
public static final int NET_PORT
- See Also:
Port, Constant Field Values
-
POSTGRES_DATABASE_NAME
public static final int POSTGRES_DATABASE_NAME
- See Also:
Database.Name, Constant Field Values
-
POSTGRES_SERVER_NAME
public static final int POSTGRES_SERVER_NAME
- See Also:
Server.Name, Constant Field Values
-
POSTGRES_USERNAME
public static final int POSTGRES_USERNAME
- See Also:
User.Name, Constant Field Values
-
FIREWALLD_ZONE_NAME
public static final int FIREWALLD_ZONE_NAME
- See Also:
FirewallZone.Name, Constant Field Values
-
LINUX_USERNAME
public static final int LINUX_USERNAME
- See Also:
User.Name, Constant Field Values
-
IDENTIFIER
public static final int IDENTIFIER
- See Also:
Identifier, Constant Field Values
-
SMALL_IDENTIFIER
public static final int SMALL_IDENTIFIER
- See Also:
SmallIdentifier, Constant Field Values
-
HASHED_KEY
public static final int HASHED_KEY
- See Also:
HashedKey, Constant Field Values
-
MILLIS_PER_DAY
public static final long MILLIS_PER_DAY
The number of milliseconds in a day.- See Also:
- Constant Field Values
-
-
Method Detail
-
alignRight
public boolean alignRight()
-
alignRight
public static boolean alignRight(int id)
-
cast
public Object cast(AOServConnector conn, Object value, Type castToType) throws IOException, SQLException
Casts one type of object to another. These casts are allowed:P O S P M T O F Y G S I S M R T P R Q Y M E G O E S H L S Y S R S W M A _ Q S M _ E T A L A D S D L Q Y D S G L I L D O H A _ L S A _ R L N L B O M D E M T S _ Q T S E D U _ A I O I M A O D A A E T L A E S _ X I I H C D D P C G A I M _ C B R A _ B R _ Z _ D D A C E E H I _ T U _ I N A G P L _ A V B U N A V U O U E E S T O B C C O N A A S D N _ I R A I A S E L S E S E S N S N N H O U O I I D S T D L S E E _ L N O S N D E R E E T E R E E E T T E N O M M O E F T E D _ P S T R C L A _ G U S U D M _ _ _ R _ _ _ R _ R I I D T L D A A U M F L N R R L L P P H H R T N Z I A B N E P W X R O N N N N P N N N N N F F _ I E A L L B A K O A I V E O O K A O O I I U A O M B E A C _ O _ E N A A A A O A A A A A I I K N A T _ _ L I E A M N A S N N E T N R N M R M N A E L M O I R I S E M M M M R M M M M M E E E FROM G N E 2 3 E L Y T E T L S G G Y H E T G E L E E L L S E S D D D S Y E E E E T E E E E E R R Y ACCOUNTING X X BOOLEAN X X X X X X X X X X X DATE X X X X X X X X X X X X DECIMAL_2 X X X X X X X X X X X X X DECIMAL_3 X X X X X X X X X X X X X DOUBLE X X X X X X X X X X X X X EMAIL X X X X X X X X FKEY X X X X FLOAT X X X X X X X X X X X X X HOSTNAME X X X X X INT X X X X X X X X X X X X X X X X X INTERVAL X X X X X X X X X X X IP_ADDRESS X X LONG X X X X X X X X X X X X X X X OCTAL_LONG X X X X X X X X X X X X X X X PKEY X X X X PATH X X PHONE X X X SHORT X X X X X X X X X X X X X STRING X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X TIME X X X X X URL X X X X X X USERNAME X X X X X ZONE X X X X BIG_DECIMAL X X X X X X X X X X X X X X DOMAIN_LABEL X X X X DOMAIN_LABELS X X X DOMAIN_NAME X X X X X GECOS X X GROUP_ID X X HASHED_PASSWORD X X LINUX_ID X X X X MAC_ADDRESS X X MONEY X X X MYSQL_DATABASE_NAME X X MYSQL_SERVER_NAME X X MYSQL_TABLE_NAME X X MYSQL_USERNAME X X X X NET_PORT X X X POSTGRES_DATABASE_NAME X X POSTGRES_SERVER_NAME X X POSTGRES_USERNAME X X X X FIREWALLD_ZONE_NAME X X LINUX_USERNAME X X X X X IDENTIFIER X X X SMALL_IDENTIFIER X X X X X HASHED_KEY X X- Throws:
IOExceptionSQLException
-
getDaysFromMillis
public static long getDaysFromMillis(long time)
Gets the number of days from epoch in GMT.
-
getMillisFromDays
public static long getMillisFromDays(long days)
Gets the number of milliseconds from epoch in GMT.
-
roundToDate
public static long roundToDate(long time)
Rounds the time to an exact day in GMT.
-
compareTo
public int compareTo(Object value1, Object value2) throws IllegalArgumentException, SQLException, UnknownHostException
-
compareTo
public static int compareTo(Object value1, Object value2, int id) throws IllegalArgumentException, SQLException, UnknownHostException
Compares two values lexicographically. The values must be of the same type.- Parameters:
value1- the first value being comparedvalue2- the second value being comparedid- the data type- Returns:
- the value
0if the two values are equal; a value less than0if the first value is lexicographically less than the second value; and a value greater than0if the first value is lexicographically greater than the second value. - Throws:
IllegalArgumentException- if the type is invalidSQLExceptionUnknownHostException
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,Type>
-
getId
public int getId()
-
getName
public String getName()
-
getSinceVersion_version
public String getSinceVersion_version()
-
getSinceVersion
public AoservProtocol getSinceVersion(AOServConnector connector) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getLastVersion_version
public String getLastVersion_version()
-
getLastVersion
public AoservProtocol getLastVersion(AOServConnector connector) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,Type>
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,Type>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,Type>- Throws:
IOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,Type>- Throws:
IOException
-
toStringImpl
public String toStringImpl()
Description copied from class:AOServObjectAOServObject.toString()implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callsAOServObject.toString()on the key (fromAOServObject.getKey()). When the key isnull, uses the default implementation fromObject.toString().- Overrides:
toStringImplin classGlobalObjectIntegerKey<Type>
-
supportsPrecision
public boolean supportsPrecision()
Checks if this type supports any precisions other than default-1. This can be used to short-cut somethings when it is known no precisions will be returned.
-
supportsPrecision
public static boolean supportsPrecision(int type)
Checks if the given type supports any precisions other than default-1. This can be used to short-cut somethings when it is known no precisions will be returned.
-
getMaxPrecision
public int getMaxPrecision()
Gets the maximum precision for this type or-1when unbounded. This can be used to stop searching for largest precision once the maximum possible value has been found.
-
getMaxPrecision
public static int getMaxPrecision(int type)
Gets the maximum precision for the given type or-1when unbounded. This can be used to stop searching for largest precision once the maximum possible value has been found.
-
getPrecision
public int getPrecision(Object value)
-
getPrecision
public static int getPrecision(Object value, int type)
-
getString
public static String getString(Object value, int precision, int type) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
parseString
public Object parseString(String S) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
parseString
public static Object parseString(String S, int id) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-