DLV
Class PredicateMetaData

java.lang.Object
  extended byDLV.PredicateMetaData

public class PredicateMetaData
extends java.lang.Object

An object that can be used to get information about the types and properties of the "columns" in a Predicate object (in a relational database view of predicates).
Note that:
- A Predicate object may not have a PredicateMetaData object associated with it.
- You must set a PredicateMetadata for a Predicate object if you want to use some JDBC like methods.
- Allowed types and corresponding JDBC types are specified in ConversionType

Version:
1.0
Author:
Francesco Ricca
See Also:
Predicate, ConversionType

Constructor Summary
PredicateMetaData(int arity)
          Builds a PredicateMetadata object for a predicate of arity "arity".
PredicateMetaData(java.sql.ResultSetMetaData rsmd)
          Builds a PredicateMetadata object for a predicate from a java.sql.ResultSetMetaData descriptor.
 
Method Summary
 int getArgumentByName(java.lang.String argumentName)
          Gets the position of the first argument named "argumentName".
 int getArity()
          Gets the Predicate arity.
 java.lang.String getName(int argument)
          Gets the name of the argument-th column.
 byte getType(int argument)
          Gets the type of the argument-th column.
 void setName(int argument, java.lang.String argumentName)
          Sets the name of the argument-th column.
 void setType(int argument, byte conversionType)
          Sets the Predicate arity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredicateMetaData

public PredicateMetaData(int arity)
Builds a PredicateMetadata object for a predicate of arity "arity". Column names are set to null and column types are set to ConversionType.STRING

Parameters:
arity - the corresponding Predicate-arity.

PredicateMetaData

public PredicateMetaData(java.sql.ResultSetMetaData rsmd)
                  throws java.sql.SQLException
Builds a PredicateMetadata object for a predicate from a java.sql.ResultSetMetaData descriptor.

Column names and types are set to the corresponding ResultSet column names and types.
JDBC Types are transated using ConversionType.sqlToDlvTypes(int) function.

Parameters:
rsmd - a java.sql.ResultSetMetaData descriptor.
See Also:
ConversionType
Method Detail

getArity

public int getArity()
Gets the Predicate arity.

Returns:
The Predicate arity.

setType

public void setType(int argument,
                    byte conversionType)
Sets the Predicate arity.

Parameters:
argument - An integer indicating a column.
conversionType - The column type.
See Also:
ConversionType

getType

public byte getType(int argument)
Gets the type of the argument-th column.

Parameters:
argument - An integer indicating a column.
Returns:
The type of the argument-th column.
See Also:
ConversionType

setName

public void setName(int argument,
                    java.lang.String argumentName)
Sets the name of the argument-th column.

Parameters:
argument - An integer indicating a column.
argumentName - A String object which contains the name of the specified column.

getName

public java.lang.String getName(int argument)
Gets the name of the argument-th column.

Parameters:
argument - An integer indicating a column.
Returns:
The name of the argument-th column.

getArgumentByName

public int getArgumentByName(java.lang.String argumentName)
Gets the position of the first argument named "argumentName".

Parameters:
argumentName - A String object which contains a column name.
Returns:
the position of the first argument named "argumentName".
Throws:
BadColumnNameException - If "argumentName" does not correspond to a column name.