org.outerj.xreporter.datatype.operator
Interface Operator

All Known Implementing Classes:
Between, Equals, GreaterThan, GreaterThanOrEquals, In, IsNotNull, IsNull, LessThan, LessThanOrEquals, Like, NotBetween, NotEquals, NotIn, NotLike

public interface Operator

Implementations of this interface contain metadata about SQL operators and logic to generate the SQL for that operator.


Method Summary
 void generateNaturalDescription(java.lang.StringBuffer description, java.lang.String title, java.lang.String[] values, ResourceHandle resourceHandle)
          Generates a human readable representation of this operator applied to some values.
 void generateSql(java.lang.StringBuffer statement, java.lang.String fieldName, int argumentCount)
          Generates a piece of SQL for this operator.
 int getArgumentCount()
          Get the number of arguments that this operator can take.
 java.lang.String getDescription(ResourceHandle resourceHandle)
          Something that can be shown to an end-user to identify this operator.
 java.lang.String getId()
          An ID for this operator.
 

Method Detail

getId

public java.lang.String getId()
An ID for this operator. This should be a simple, short, spaceless string.


getDescription

public java.lang.String getDescription(ResourceHandle resourceHandle)
Something that can be shown to an end-user to identify this operator.


getArgumentCount

public int getArgumentCount()
Get the number of arguments that this operator can take. For a variable (unlimitted) number of arguments this returns -1.


generateSql

public void generateSql(java.lang.StringBuffer statement,
                        java.lang.String fieldName,
                        int argumentCount)
Generates a piece of SQL for this operator. This should be in PreparedStatement-style. Values must hence by represented by question marks.

Parameters:
statement - A StringBuffer to which the generated SQL should be appended.

generateNaturalDescription

public void generateNaturalDescription(java.lang.StringBuffer description,
                                       java.lang.String title,
                                       java.lang.String[] values,
                                       ResourceHandle resourceHandle)
Generates a human readable representation of this operator applied to some values.

Parameters:
description - stringbuffer to which the description will be appended
title - can be null
values - for operators with a fixed number of arguments, this array should have the same size