com.ibm.pdq.annotation

Annotation Type Format


@Target(value={METHOD,FIELD})

  • @Retention(value=RUNTIME)
  • public @interface Format
    The Format anotation is used to specify a class that contains methods for converting field data between String format and JDBC Object, in both directions. When retrieving objects from a database ResultSet, JDBC objects can be formatted into Strings. When the annotated field is used as an input parameter for an SQL statement, the reverse operation can be performed - converting the contents of a String into the expected JDBC object type.

    See the pureQuery Runtime documentation for more information about using the Format annotation.


    Required Element Summary

    Modifier and Type Required Element and Description
    1. Class<?>
    formatterClass
    Specifies a java class that will be used to do the formatting and parsing between java Object and a formatted string.
    1. String
    formattingOptions
    Specifies a string containing options directing the formattingClass how to do the formatting and parsing between String and JDBC object.

    Required Element Detail

    formatterClass

    public abstract Class<?> formatterClass
    
    Specifies a java class that will be used to do the formatting and parsing between java Object and a formatted string. The class must provide - A constructor method, that takes a single String argument. During execution, this String argument will receive the formattingOptions string specified below. the constructor should parse and process or store the input options as necessary for later use by the format and parse methods - A format() method, which will be used when retrieving data from a resultSet. The method should take the java Object, as returned by the Resultset and format it into a String, then return the String. - A parse() method, which will be used when the annotated field is used as an input parameter. The method will take a String argument, which is assumed to be in a certain format, then parse it and create an appropriate Object for use as an input parameter on the associated SQL statement.

    formattingOptions

    public abstract String formattingOptions
    
    Specifies a string containing options directing the formattingClass how to do the formatting and parsing between String and JDBC object.