public final class IlrFormat
extends java.lang.Object
implements java.io.Serializable
IlrType of the object, or
according to the Java class.
Initially, a SimpleDateFormat is created using the
pattern M/d/yyyy H:mm. The locale provided by the
engine resource mechanism. This format is associated with the Java class
java.util.Date.| Constructor and Description |
|---|
IlrFormat(IlrObjectModel objectModel) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyDatePattern(java.lang.String pattern)
Changes the pattern of the simple date format used to parse and
write the date literals.
|
java.lang.String |
format(IlrType type,
java.lang.Object obj)
Prints an object to a string.
|
java.lang.String |
format(java.lang.Object obj)
Prints an object to a string.
|
java.lang.String |
formatWithClassname(java.lang.Object obj)
Print
|
java.text.Format |
getFormat(java.lang.Class aclass)
Gets the Java format for a Java class.
|
java.text.Format |
getFormat(IlrType type)
Gets the Java format for an
IlrType. |
java.text.Format[] |
getFormats()
Gets all the Java formats currently known by this instance.
|
java.lang.Class |
getInheritedNativeClass(IlrType type) |
boolean |
isSupported(java.lang.Class aclass) |
boolean |
isSupported(IlrType type)
Returns
true if the objects of
type can be formatted. |
java.lang.Object |
parse(java.lang.Class aclass,
java.lang.String source)
Parses a string and constructs an object of the specified class.
|
java.lang.Object |
parse(IlrType type,
java.lang.String source)
Parses a string and constructs an object.
|
void |
setFormat(java.lang.Class aclass,
java.text.Format format)
Associates a format object with a Java class.
|
void |
setFormat(IlrType type,
java.text.Format format)
Associates a format object with an
IlrType. |
public IlrFormat(IlrObjectModel objectModel)
public java.text.Format getFormat(IlrType type)
IlrType.type - An IlrType.null if no format can be obtained of the
instances of the passed class.public void setFormat(IlrType type, java.text.Format format)
IlrType. Later on, the format
will be used to convert instances of this type into strings and
vice versa.type - An IlrType.format - A Java format.public java.text.Format getFormat(java.lang.Class aclass)
aclass - A Java class.null if no format can be
obtained of the instances of the passed class.public void setFormat(java.lang.Class aclass,
java.text.Format format)
aclass - A Java class.format - A Java format.public java.text.Format[] getFormats()
public void applyDatePattern(java.lang.String pattern)
SimpleDateFormat.pattern - The new pattern used to read and write date literals.public java.lang.Object parse(IlrType type, java.lang.String source) throws java.text.ParseException
IlrType.getNativeClass(),
the format for the native type is used.
If no format is found, an exception is thrown.
If exceptions are encountered during parsing, a ParseException is thrown.IlrMissingFormatException - If no format is found for the
requested class.java.text.ParseException - If the passed string raises parsing errors.type - The type of the object to be constructed.source - A string to be parsed using a format.public boolean isSupported(IlrType type)
true if the objects of
type can be formatted.public boolean isSupported(java.lang.Class aclass)
public java.lang.Class getInheritedNativeClass(IlrType type)
public java.lang.Object parse(java.lang.Class aclass,
java.lang.String source)
throws java.text.ParseException
ParseException is thrown.IlrMissingFormatException - If no format is found for the
requested class.java.text.ParseException - If the passed string raises parsing errors.java.lang.NumberFormatException - If the passed string was considered but cannot be parsed as a number.aclass - The class of the object to be constructed.source - A string to be parsed using a format.public java.lang.String format(IlrType type, java.lang.Object obj)
toString() on the object and returns the result.type - The type used to select a format.obj - The object to format.public java.lang.String formatWithClassname(java.lang.Object obj)
public java.lang.String format(java.lang.Object obj)
toString() on the object and returns the result.obj - The object to format.© Copyright IBM Corp. 1987, 2017