Class CommonConstants
This class provides a bunch of commonly used constants.
The constants are arranged into several categories.
- Physical constants like gravity and speed of light.
- XML constants, like often used names for entities and attributes.
- Miscellaneous constants like the empty string or the null char.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: CommonConstants.java 1151 2025-10-01 21:32:15Z tquadrat $
- Since:
- 0.0.5
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.lang.CommonConstants"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CharsetThe reference to the ASCII character set.static final StringThe lead-in for a CDATA wrapped String: "<![CDATA["static final StringThe lead-out for a CDATA wrapped String: "]]>"static final charThe horizontal ellipsis: … (…/…/…/…).static final charThe hyphen character (‐/‐/‐/HYPHEN).
This is different from the character '-' (HYPHEN-MINUS), although it looks similar.static final charThe non-breaking space character ( / ).static final charThe small non-breaking space character ( / ).static final charThe zero-width non-breaking space character; in fact, the 'word joiner' character that should be used instead of the original character.static final StringThe line terminator as defined by the underlying operating system.static final charThe decimal separator for the current locale.static final StringThe default application id if nothing else could be used: "Default Program Main".static final CharSequenceAn empty char sequence.static final Object[]An empty array ofObjectobjects.static final StringThe empty string.static final String[]An empty array ofStringinstances.static final StringThe Java installation directory: "JAVA_HOME".static final intThe End-Of-File marker for streams: -1.static final BigDecimalThe Gravity constant: 6.672E-11 (N * m2)/(kg2).Returnstrueif the provided reference isnullotherwise returnsfalse.static final CharsetThe reference to the ISO-8859-1 character set.Returnstrueif the provided reference is non-nullotherwise returnsfalse.static final intThe index value indicating that nothing was found: -1.static final StringA String containing onlyNUL(theNULL_CHAR).static final charThe null character.static final StringA String containing the sequence "null".static final StringThe system property for the application id as used by the logging sub-system: "org.tquadrat.logging.applicationId".static final StringThe vested system property for the current class path: "java.class.path".static final StringThe vested system property for the architecture of the current CPU: "os.arch".static final StringThe vested system property for the file encoding used by the JVM: "file.encoding".static final StringThe system property providing the flag that indicates whether the program is running in a headless mode, meaning that is does not have any kind of a graphical user interface: "java.awt.headless".static final StringThe system property that is used to enable the debug mode: "isDebug".static final StringThe system property that is used to enable the test mode: "isTest".static final StringThe vested system property for the Java installation directory: "java.home".static final StringThe system property for the name of the Java runtime: "java.runtime.name".static final StringThe vested system property for the Java vendor: "java.vendor".static final StringThe vested system property for the homepage URL of the Java vendor: "java.vendor.url".static final StringThe vested system property for the Java version: "java.version".static final StringThe vested system property for the name of the current JVM: "java.vm.name".static final StringThe vested system property for the name of the vendor for the current JVM: "java.vm.vendor".static final StringThe vested system property for the version of the current JVM: "java.vm.version".static final StringThe vested system property for the line separator: "line.separator".static final StringThe optional system property for the name of the class that provides the configuration the JDK logger: "java.util.logging.config.class".static final StringThe optional system property for the name of the configuration file for the JDK logger: "java.util.logging.config.file".static final StringThe optional system property for enabling java mail session debug: "javax.mail.Session.debug".static final StringThe (vested [?])static final StringThe system property for the name of the packages with URL protocol handlers: "java.protocol.handler.pkgs".static final StringThe vested system property for the name of the current operating system: "os.name".static final StringThe vested system property for the version of the current operating system: "os.version".static final StringThe system property for the location of the system preferences files on a UNIX/Linux system: "java.util.prefs.systemRoot".
If not set, the location is/etc/, resulting to/etc/.java/.systemPrefs.
If the default location is used, the respective folder has to be created by a user withrootpermissions; the files in there should have the rights 544, while the folder and its sub-folders should have 755.static final StringThe system property for the location of the user preferences files on a UNIX/Linux system: "java.util.prefs.userRoot".
If not set, the location is~/, resulting to~/.java/.userPrefs/.static final StringThe system property for the synchronisation interval of the preferences on a UNIX/Linux system, in seconds: "java.util.prefs.syncInterval".
If not set, the interval is 30 seconds.static final StringThe system property that is used to force the encoding for aPropertyResourceBundle: "java.util.PropertyResourceBundle.encoding".static final StringThe system property for the class name of the SAX XML parser factory: "javax.xml.parsers.SAXParserFactory".static final StringThe system property for the name of the file with the SSL key store: "javax.net.ssl.keyStore".static final StringThe system property for the password for the SSL key store: "javax.net.ssl.keyStorePassword".static final StringThe vested system property for the name of thetempfolder that is used by the current user: "java.io.tmpdir".static final StringThe system property for the country code setting for the current user: "user.country".static final StringThe vested system property for the name of the current working directory of the current user: "user.dir".static final StringThe vested system property for the name of the home directory of the current user: "user.home".static final StringThe system property for the language code setting the current user: "user.language".static final StringThe vested system property for the name of the current user: "user.name".static final StringThe system property for the time zone setting the current user: "user.timezone".static final BigDecimalThe speed of light in km per second = 299792.458 km/s.static final BigDecimalThe value for 1 G: 9.80665 m/(s2)static final charThe grouping separator for the current locale, used with large numbers to separate thousands.static final StringThe name of the main thread group: "main".
This is the group of the main thread.static final StringThe name of the system thread group: "system".
This is the group of several system threads and the parent thread group for the main thread group.static final longThe time between 1582-10-15T00:00 (the start of the Gregorian calendar) and 1970-01-01T00:00 (the beginning of the "Epoch") in seconds: 12219292800L.static final BigDecimalThe length of a (tropical) year in days, according to SI: 365.242190517 d.static final StringA String containing the sequence "<UNKNOWN>".static final CharsetThe reference to the US-ASCII character set; this is the same as the ASCII character set.static final TimeZoneDeprecated, for removal: This API element is subject to removal in a future version.static final CharsetThe reference to the UTF-8 character set.static final StringThe attribute name for an XML attribute holding a category of something: "category".static final StringThe attribute name for an XML attribute holding a class name: "class".static final StringThe attribute name for an XML attribute holding a date, usually without the time information: "date".static final StringThe attribute name for an XML attribute holding a file name: "file".static final StringThe attribute name for the XML id attribute: "xml:id".static final StringThe attribute name for the XML idref attribute: "idref".static final StringThe attribute name for the XML language attribute: "xml:lang".static final StringThe attribute name for the XML name attribute: "name".
Only names that follow exact rules for their character set can be stored in XML attributes, but free names have to be stored as XML elements.static final StringThe name for the node id XML attribute: "node".static final StringThe name for the PID XML attribute: "pid".static final StringThe name for the reference XML attribute: "reference".static final StringThe name for the sequence number XML attribute: "sequenceNumber".static final StringThe name for the status XML attribute: "status".static final StringThe attribute name for an XML attribute holding a time, usually without the date information: "time".static final StringThe name for an XML attribute holding a date/time: "timestamp".static final StringThe name for an XML attribute holding a type, in the sense of a category or model, and usually not in the sense this term is used in the context of programming languages: "type".static final StringThe name for the user id XML attribute: "userId".static final StringThe name for the version XML attribute: "version".static final StringThe attribute name for the XML space attribute: "xml:space".static final StringThe element name for an XML element representing a comment: "comment".
This is not an XML comment (they will be written as<!static final StringThe element name for an XML element holding a date, usually without the time information: "date".static final StringThe element name for an XML element representing a description of some kind: "description".static final StringThe element name for an XML element containing a message: "message".static final StringThe element name for an XML element representing a name of some kind: "name".
Only names that follow exact rules for their character set can be stored in XML attributes, but free names have to be stored as XML elements.static final StringThe element name for an XML element holding text: "text".static final StringThe element name for an XML element holding a time, usually without the date information: "time".static final StringThe name for an XML element holding a date/time: "timestamp".static final ZoneIdDeprecated.UseZoneOffset.UTCinstead. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
CHAR_ELLIPSIS
The horizontal ellipsis: … (…/…/…/…).- See Also:
-
CHAR_HYPHEN
The hyphen character (‐/‐/‐/HYPHEN).
This is different from the character '-' (HYPHEN-MINUS), although it looks similar. This character can be used as a replacement for the HYPHEN-MINUS in contexts where HYPHEN-MINUS has a special meaning.- See Also:
-
CHAR_NBSP
-
CHAR_NNBSP
The small non-breaking space character ( / ).- See Also:
-
CHAR_ZWNBSP
The zero-width non-breaking space character; in fact, the 'word joiner' character that should be used instead of the original character.- See Also:
-
EMPTY_Object_ARRAY
-
EMPTY_String_ARRAY
-
GRAVITY_CONSTANT
The Gravity constant: 6.672E-11 (N * m2)/(kg2). An alternative unit for the constant is (m3)/(kg * s2). -
SPEED_OF_LIGHT
The speed of light in km per second = 299792.458 km/s. -
STANDARD_G
The value for 1 G: 9.80665 m/(s2) -
TIME_DELTA_BEGINGREGORIAN2BEGINEPOCH
The time between 1582-10-15T00:00 (the start of the Gregorian calendar) and 1970-01-01T00:00 (the beginning of the "Epoch") in seconds: 12219292800L.
This constant is used for example to determine the number of nanoseconds since the beginning of the Gregorian calendar, and that is used to create UUIDs based on time and location.
- See Also:
-
TROPICAL_YEAR
The length of a (tropical) year in days, according to SI: 365.242190517 d. -
ENV_JAVA_HOME
-
PROPERTY_APPLICATIONID
-
PROPERTY_CLASSPATH
-
PROPERTY_CPUARCHITECTURE
-
PROPERTY_FILE_ENCODING
-
PROPERTY_HEADLESS
The system property providing the flag that indicates whether the program is running in a headless mode, meaning that is does not have any kind of a graphical user interface: "java.awt.headless".
Instead of checking the property directly, a call to
java.awt.GraphicsEnvironment#isHeadless()will return the same result, but it would require to add the modulejava.desktopto the dependencies of the current module.JavaFX does not have a headless mode as such (although there are several solutions for headless testing of JavaFX applications), but this flag can still be used to decide whether a JavaFX can run or not: basically, AWT, Swing and JavaFX need the same resources, a keyboard, a mouse and a graphical display.
- See Also:
-
PROPERTY_IS_DEBUG
-
PROPERTY_IS_TEST
-
PROPERTY_JAVA_HOME
-
PROPERTY_JAVA_RUNTIME
-
PROPERTY_JAVA_VENDOR
-
PROPERTY_JAVA_VENDOR_URL
-
PROPERTY_JAVA_VERSION
-
PROPERTY_JVM_NAME
-
PROPERTY_JVM_VENDOR
-
PROPERTY_JVM_VERSION
-
PROPERTY_LINE_SEPARATOR
-
PROPERTY_LOGGING_CONFIG_CLASS
-
PROPERTY_LOGGING_CONFIG_FILE
-
PROPERTY_MAIL_SESSION_DEBUG
-
PROPERTY_MODULEPATH
-
PROPERTY_NET_PROTOCOL_PKGS
-
PROPERTY_OSNAME
-
PROPERTY_OSVERSION
-
PROPERTY_PREFS_ROOT_SYSTEM
The system property for the location of the system preferences files on a UNIX/Linux system: "java.util.prefs.systemRoot".
If not set, the location is/etc/, resulting to/etc/.java/.systemPrefs.
If the default location is used, the respective folder has to be created by a user withrootpermissions; the files in there should have the rights 544, while the folder and its sub-folders should have 755.- See Also:
-
PROPERTY_PREFS_ROOT_USER
-
PROPERTY_PREFS_SYNC
The system property for the synchronisation interval of the preferences on a UNIX/Linux system, in seconds: "java.util.prefs.syncInterval".
If not set, the interval is 30 seconds. The minimum value is one second.- See Also:
-
PROPERTY_RESOURCEBUNDLE_ENCODING
The system property that is used to force the encoding for a
PropertyResourceBundle: "java.util.PropertyResourceBundle.encoding". Valid values are "UTF-8" and "ISO-8859-1".- See Also:
-
PROPERTY_SAX_PARSER_FACTORY
-
PROPERTY_SSL_KEYSTORE
-
PROPERTY_SSL_KEYSTORE_PASSWORD
-
PROPERTY_TEMPFOLDER
-
PROPERTY_USER_COUNTRY
-
PROPERTY_USER_DIR
-
PROPERTY_USER_HOME
-
PROPERTY_USER_LANG
-
PROPERTY_USER_NAME
-
PROPERTY_USER_TIMEZONE
-
ASCII
-
ISO8859_1
-
US_ASCII
-
UTF8
-
UTC
@Deprecated(since="0.4.4", forRemoval=true) @API(status=DEPRECATED, since="0.0.5") public static final TimeZone UTCDeprecated, for removal: This API element is subject to removal in a future version.As thejava.util.DateAPI is now obsolete, also the related classes, likejava.util.TimeZoneshould be used no longer.The basic time zone (the time zone for the 'Universal Time Code'). -
ZONE_UTC
@Deprecated(since="0.4.4", forRemoval=false) @API(status=DEPRECATED, since="0.0.6") public static final ZoneId ZONE_UTCDeprecated.UseZoneOffset.UTCinstead.The basic time zone (the time zone for the 'Universal Time Code'). -
CDATA_LEADIN
-
CDATA_LEADOUT
-
THREADGROUP_MAIN
-
THREADGROUP_SYSTEM
-
XMLATTRIBUTE_Category
-
XMLATTRIBUTE_Class
-
XMLATTRIBUTE_Date
-
XMLATTRIBUTE_File
-
XMLATTRIBUTE_Id
-
XMLATTRIBUTE_IdRef
-
XMLATTRIBUTE_Language
-
XMLATTRIBUTE_Name
-
XMLATTRIBUTE_NodeId
-
XMLATTRIBUTE_PID
-
XMLATTRIBUTE_Reference
-
XMLATTRIBUTE_SequenceNumber
-
XMLATTRIBUTE_Status
-
XMLATTRIBUTE_Time
-
XMLATTRIBUTE_Timestamp
-
XMLATTRIBUTE_Type
-
XMLATTRIBUTE_UserId
-
XMLATTRIBUTE_Version
-
XMLATTRIBUTE_Whitespace
The attribute name for the XML space attribute: "xml:space".
This reserved attribute indicates whether any whitespace inside the element is significant and should not be altered by the XML processor. The attribute can take one of two enumerated values:
preserve- The XML application preserves all whitespace (newlines, spaces, and tabs) present within the element.
default- The XML processor uses its default processing rules when deciding to preserve or discard the whitespace inside the element.
- See Also:
-
XMLELEMENT_Comment
The element name for an XML element representing a comment: "comment".
This is not an XML comment (they will be written as<!-- … -->in the XML stream) but data that is semantically a comment (like adescription, see below).- See Also:
-
XMLELEMENT_Date
-
XMLELEMENT_Description
-
XMLELEMENT_Message
-
XMLELEMENT_Name
The element name for an XML element representing a name of some kind: "name".
Only names that follow exact rules for their character set can be stored in XML attributes, but free names have to be stored as XML elements.- See Also:
-
XMLELEMENT_Text
-
XMLELEMENT_Time
-
XMLELEMENT_Timestamp
-
CR
-
DECIMAL_SEPARATOR
The decimal separator for the current locale. -
DEFAULT_APPLICATION_ID
-
EMPTY_STRING
-
EMPTY_CHARSEQUENCE
An empty char sequence. -
EOF
-
NOT_FOUND
-
NUL
-
NULL_CHAR
-
NULL_STRING
-
THOUSANDS_SEPARATOR
The grouping separator for the current locale, used with large numbers to separate thousands. -
UNKNOWN_STRING
-
IS_NULL
-
NON_NULL
-
-
Constructor Details
-
CommonConstants
private CommonConstants()No instance of this class is allowed.
-

java.util.DateAPI is now obsolete, also the related classes, likejava.util.TimeZoneshould be used no longer.