Package io.guise.framework
Class Resources
- java.lang.Object
-
- io.guise.framework.Resources
-
public class Resources extends java.lang.Object
Definitions of Guise resources.- Author:
- Garret Wilson
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPLICATION_COPYRIGHT
static java.lang.String
APPLICATION_DESCRIPTION
static java.lang.String
APPLICATION_LABEL
static java.lang.String
APPLICATION_NAME
static java.lang.String
APPLICATION_NAME_SHORT
static java.lang.String
APPLICATION_VERSION
static java.lang.String
CONVERTER_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
The resource reference for a converter message indicating that a value is invalid.static java.lang.String
DEFAULT_RESOURCE_BUNDLE_BASE_NAME
The default base name of the Guise resource bundle.static java.lang.String
GLYPH_PROPERTY_KEY_ASPECT
The aspect used to identify glyphs as part of resource property keys.static java.lang.String
INFO_PROPERTY_KEY_ASPECT
The aspect used to identify info as part of resource property keys.static java.lang.String
LABEL_PROPERTY_KEY_ASPECT
The aspect used to identify labels as part of resource property keys.static java.lang.String
RESOURCES_NAMESPACE_PREFIX
Deprecated.static java.net.URI
RESOURCES_NAMESPACE_URI
Deprecated.static char
STRING_VALUE_REFERENCE_PREFIX_CHAR
The prefix character used to introduce string value references.static java.lang.String
VALIDATION_FALSE_MESSAGE_RESOURCE_REFERENCE
The resource bundle key for a general failed validation message.static java.lang.String
VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
The resource reference for a validator message indicating that a value is invalid.static java.lang.String
VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE
The resource reference for a validator message indicating that a value is required.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
createStringResourceReference(java.lang.String resourceKey)
Creates a string containing a reference to the given string resource key.static java.lang.String
createStringValueReference(java.lang.String value)
Creates a string containing a value that can be used as an argument in formatting.static java.net.URI
createURIResourceReference(java.lang.String resourceKey)
Creates a URI containing a reference to the given string resource key.static <E extends java.lang.Enum<E>>
java.net.URIgetGlyphResourceReference(E e)
Returns a resource reference for the glyph aspect of a resource key based upon the given enum.static <E extends java.lang.Enum<E>>
java.net.URIgetGlyphResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the glyph aspect of a resource key based upon the given enum class.static <E extends java.lang.Enum<E>>
java.lang.StringgetInfoResourceReference(E e)
Returns a resource reference for the info aspect of a resource key based upon the given enum.static <E extends java.lang.Enum<E>>
java.lang.StringgetInfoResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the info aspect of a resource key based upon the given enum class.static <E extends java.lang.Enum<E>>
java.lang.StringgetLabelResourceReference(E e)
Returns a resource reference for the label aspect of a resource key based upon the given enum.static <E extends java.lang.Enum<E>>
java.lang.StringgetLabelResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the label aspect of a resource key based upon the given enum class.static java.lang.String
getResourceKeyName(java.lang.Enum<?> e)
Returns a form of the enum name appropriate for a resource key.
-
-
-
Field Detail
-
RESOURCES_NAMESPACE_PREFIX
@Deprecated public static final java.lang.String RESOURCES_NAMESPACE_PREFIX
Deprecated.The recommended prefix to the resources key ontology namespace.- See Also:
- Constant Field Values
-
RESOURCES_NAMESPACE_URI
@Deprecated public static final java.net.URI RESOURCES_NAMESPACE_URI
Deprecated.The URI to the resource key ontology namespace.
-
DEFAULT_RESOURCE_BUNDLE_BASE_NAME
public static final java.lang.String DEFAULT_RESOURCE_BUNDLE_BASE_NAME
The default base name of the Guise resource bundle.
-
STRING_VALUE_REFERENCE_PREFIX_CHAR
public static final char STRING_VALUE_REFERENCE_PREFIX_CHAR
The prefix character used to introduce string value references.- See Also:
- Constant Field Values
-
LABEL_PROPERTY_KEY_ASPECT
public static final java.lang.String LABEL_PROPERTY_KEY_ASPECT
The aspect used to identify labels as part of resource property keys.- See Also:
- Constant Field Values
-
GLYPH_PROPERTY_KEY_ASPECT
public static final java.lang.String GLYPH_PROPERTY_KEY_ASPECT
The aspect used to identify glyphs as part of resource property keys.- See Also:
- Constant Field Values
-
INFO_PROPERTY_KEY_ASPECT
public static final java.lang.String INFO_PROPERTY_KEY_ASPECT
The aspect used to identify info as part of resource property keys.- See Also:
- Constant Field Values
-
APPLICATION_NAME
public static final java.lang.String APPLICATION_NAME
-
APPLICATION_NAME_SHORT
public static final java.lang.String APPLICATION_NAME_SHORT
-
APPLICATION_LABEL
public static final java.lang.String APPLICATION_LABEL
-
APPLICATION_DESCRIPTION
public static final java.lang.String APPLICATION_DESCRIPTION
-
APPLICATION_COPYRIGHT
public static final java.lang.String APPLICATION_COPYRIGHT
-
APPLICATION_VERSION
public static final java.lang.String APPLICATION_VERSION
-
CONVERTER_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
public static final java.lang.String CONVERTER_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
The resource reference for a converter message indicating that a value is invalid.
-
VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE
public static final java.lang.String VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE
The resource reference for a validator message indicating that a value is required.
-
VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
public static final java.lang.String VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
The resource reference for a validator message indicating that a value is invalid.
-
VALIDATION_FALSE_MESSAGE_RESOURCE_REFERENCE
public static final java.lang.String VALIDATION_FALSE_MESSAGE_RESOURCE_REFERENCE
The resource bundle key for a general failed validation message.
-
-
Method Detail
-
createStringResourceReference
public static final java.lang.String createStringResourceReference(java.lang.String resourceKey)
Creates a string containing a reference to the given string resource key. The string resource reference is a control string according to ECMA-48, "Control Functions for Coded Character Sets", Section 5.6, "Control strings". A control string begins with the Start of String control character (U+0098) and ends with a String Terminator control character (U+009C). ECMA-48 publication is also approved as ISO/IEC 6429.- Parameters:
resourceKey
- The resource key to a string in the resources which could be retrieved usingGuiseSession.getStringResource(String)
.- Returns:
- A string containing a reference to the given resource key, an ECMA-48 control string with the given resource key as its content, which can be
resolved using
GuiseSession.dereferenceString(String)
. - Throws:
java.lang.NullPointerException
- if the given resource key isnull
.- See Also:
- ECMA-48: Control Functions for Coded Character Sets
-
createStringValueReference
public static final java.lang.String createStringValueReference(java.lang.String value)
Creates a string containing a value that can be used as an argument in formatting.- Parameters:
value
- The value to be used as an argument.- Returns:
- A string containing a reference to the given value, an ECMA-48 control string beginning with 61 with the given Value as its content.
- Throws:
java.lang.NullPointerException
- if the given value isnull
.- See Also:
- ECMA-48: Control Functions for Coded Character Sets
-
createURIResourceReference
public static final java.net.URI createURIResourceReference(java.lang.String resourceKey)
Creates a URI containing a reference to the given string resource key. The URI resource reference is URI with the schemeresource
and the scheme-specific part indicating the resource key.- Parameters:
resourceKey
- The resource key to a string in the resources which could be retrieved usingGuiseSession.getURIResource(String)
.- Returns:
- A URI containing a reference to the given resource key, which can be resolved using
GuiseSession.resolveURI(URI, String...)
. - Throws:
java.lang.NullPointerException
- if the given resource key isnull
.
-
getResourceKeyName
public static java.lang.String getResourceKeyName(java.lang.Enum<?> e)
Returns a form of the enum name appropriate for a resource key. The name is converted to lowercaes and all underscore characters ('_') are replaced by periods ('.'). For example,FILE_NOT_FOUND
would producefile.not.found
.- Parameters:
e
- The enum instance to convert to a resource key.- Returns:
- A string representing the enum instance in a style appropriate for use as a resource key.
- See Also:
Enum.name()
-
getLabelResourceReference
public static <E extends java.lang.Enum<E>> java.lang.String getLabelResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the label aspect of a resource key based upon the given enum class. The resource reference will a resource key in the formcom.example.EnumClass.label
.- Type Parameters:
E
- The type of the enum.- Parameters:
enumClass
- The enum class for which to return a resource reference.- Returns:
- A string resource reference to the label aspect of a resource key based upon the given enum class.
- Throws:
java.lang.NullPointerException
- if the given enum isnull
.- See Also:
Classes.getPropertyName(Class, String)
,LABEL_PROPERTY_KEY_ASPECT
,createStringResourceReference(String)
-
getLabelResourceReference
public static <E extends java.lang.Enum<E>> java.lang.String getLabelResourceReference(E e)
Returns a resource reference for the label aspect of a resource key based upon the given enum. The resource reference will a resource key in the formcom.example.EnumClass.NAME.label
.- Type Parameters:
E
- The type of the enum.- Parameters:
e
- The enum instance for which to return a resource reference.- Returns:
- A string resource reference to the label aspect of a resource key based upon the given enum.
- Throws:
java.lang.NullPointerException
- if the given enum isnull
.- See Also:
Enums.getPropertyName(Enum, String)
,LABEL_PROPERTY_KEY_ASPECT
,createStringResourceReference(String)
-
getGlyphResourceReference
public static <E extends java.lang.Enum<E>> java.net.URI getGlyphResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the glyph aspect of a resource key based upon the given enum class. The resource reference will a resource key in the formcom.example.EnumClass.glyph
.- Type Parameters:
E
- The type of the enum.- Parameters:
enumClass
- The enum class for which to return a resource reference.- Returns:
- A URI resource reference to the glyph aspect of a resource key based upon the given enum class.
- Throws:
java.lang.NullPointerException
- if the given enum isnull
.- See Also:
Classes.getPropertyName(Class, String)
,GLYPH_PROPERTY_KEY_ASPECT
,createURIResourceReference(String)
-
getGlyphResourceReference
public static <E extends java.lang.Enum<E>> java.net.URI getGlyphResourceReference(E e)
Returns a resource reference for the glyph aspect of a resource key based upon the given enum. The resource reference will a resource key in the formcom.example.EnumClass.NAME.glyph
.- Type Parameters:
E
- The type of the enum.- Parameters:
e
- The enum instance for which to return a resource reference.- Returns:
- A URI resource reference to the glyph aspect of a resource key based upon the given enum.
- Throws:
java.lang.NullPointerException
- if the given enum isnull
.- See Also:
Enums.getPropertyName(Enum, String)
,GLYPH_PROPERTY_KEY_ASPECT
,createURIResourceReference(String)
-
getInfoResourceReference
public static <E extends java.lang.Enum<E>> java.lang.String getInfoResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the info aspect of a resource key based upon the given enum class. The resource reference will a resource key in the formcom.example.EnumClass.info
.- Type Parameters:
E
- The type of the enum.- Parameters:
enumClass
- The enum class for which to return a resource reference.- Returns:
- A string resource reference to the info aspect of a resource key based upon the given enum class.
- Throws:
java.lang.NullPointerException
- if the given enum isnull
.- See Also:
Classes.getPropertyName(Class, String)
,INFO_PROPERTY_KEY_ASPECT
,createStringResourceReference(String)
-
getInfoResourceReference
public static <E extends java.lang.Enum<E>> java.lang.String getInfoResourceReference(E e)
Returns a resource reference for the info aspect of a resource key based upon the given enum. The resource reference will a resource key in the formcom.example.EnumClass.NAME.info
.- Type Parameters:
E
- The type of the enum.- Parameters:
e
- The enum instance for which to return a resource reference.- Returns:
- A string resource reference to the info aspect of a resource key based upon the given enum.
- Throws:
java.lang.NullPointerException
- if the given enum isnull
.- See Also:
Enums.getPropertyName(Enum, String)
,INFO_PROPERTY_KEY_ASPECT
,createStringResourceReference(String)
-
-