de.mguennewig.pobjects.metadata
Class BlobType

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.AbstractType
      extended by de.mguennewig.pobjects.metadata.ScalarType
          extended by de.mguennewig.pobjects.metadata.BlobType
All Implemented Interfaces:
Type
Direct Known Subclasses:
ObjectType

public class BlobType
extends ScalarType

Binary Large Object Type.

Author:
Michael Günnewig
See Also:
Blob, PObjBlob

Field Summary
 
Fields inherited from interface de.mguennewig.pobjects.metadata.Type
CLASS_NAME, TYPE_NAME
 
Constructor Summary
BlobType()
          Creates a new Blob type.
 
Method Summary
 void addMap(MapItem item)
          Adds a mapping to this type.
 java.lang.String formatNative(java.lang.Object value)
          Map value from its `native' string representation to its internal representation based on the type.
 java.lang.Class<?> getJavaClass()
          Returns the Java class instance that is being used for the values of this type.
 int getMaxFieldSize()
          Returns the maximum field size required to enter a value of this type.
 java.lang.Object getResult(JdbcContainer db, java.sql.ResultSet rs, int column)
          Reads the value for this type from the result set.
 java.lang.Object parseNative(java.lang.String value)
          Parse value according to the `native' string representation of this type.
 void setParam(JdbcContainer db, java.sql.PreparedStatement statm, int pos, java.lang.Object value)
          Sets the parameter(s) starting at startPos.
 
Methods inherited from class de.mguennewig.pobjects.metadata.ScalarType
checkConstraints, checkSyntax, expand, getMap, getResultInc, isScalar, labelToValue, valueToLabel
 
Methods inherited from class de.mguennewig.pobjects.metadata.AbstractType
format, getDescription, getTypeClass, name, parse, setDescription, setTypeClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlobType

public BlobType()
Creates a new Blob type.

Method Detail

addMap

public void addMap(MapItem item)
Adds a mapping to this type.

Specified by:
addMap in interface Type
Overrides:
addMap in class ScalarType
Throws:
java.lang.UnsupportedOperationException - always as the values of this type can't be mapped.
See Also:
Type.getJavaClass()

getJavaClass

public java.lang.Class<?> getJavaClass()
Returns the Java class instance that is being used for the values of this type.


getMaxFieldSize

public int getMaxFieldSize()
Returns the maximum field size required to enter a value of this type.

This is the maximum number of characters required to enter a string representation of all valid values of this type. The typical size of an input field may be much smaller.

Specified by:
getMaxFieldSize in interface Type
Overrides:
getMaxFieldSize in class ScalarType
Throws:
java.lang.UnsupportedOperationException - always, as a Blob can not be entered

formatNative

public java.lang.String formatNative(java.lang.Object value)
Map value from its `native' string representation to its internal representation based on the type.

This mapping is a one-to-one mapping of string values to the type's value set, without any translation based on MapItems associated with the type.

For example, an integer type's implementation would accept a value like `1' and translate it to the string `&dblquote;1&dblquote;', independent of any label associated with the value `1'.

The value null is always mapped to the empty string.

Specified by:
formatNative in interface Type
Overrides:
formatNative in class AbstractType
Throws:
java.lang.UnsupportedOperationException - always, as a Blob can't be formated
See Also:
Type.getJavaClass()

parseNative

public java.lang.Object parseNative(java.lang.String value)
Parse value according to the `native' string representation of this type.

This representation is a one-to-one mapping of the type's value set to strings, without any translation based on MapItems associated with the type.

For example, an integer type's implementation would accept a value like `"1"' and translate it to an integer object, but would reject a label like `"Yes"' that may be associated with the value `1'.

Throws:
java.lang.UnsupportedOperationException - always, as a string can't be parsed into a Blob
See Also:
Type.addMap(MapItem), Type.parse(String)

getResult

public java.lang.Object getResult(JdbcContainer db,
                                  java.sql.ResultSet rs,
                                  int column)
Reads the value for this type from the result set.

Specified by:
getResult in interface Type
Overrides:
getResult in class ScalarType
See Also:
Type.getResultInc()

setParam

public void setParam(JdbcContainer db,
                     java.sql.PreparedStatement statm,
                     int pos,
                     java.lang.Object value)
              throws java.sql.SQLException
Sets the parameter(s) starting at startPos.

This method is the counterpart to Type.getResult(JdbcContainer,ResultSet,int) and Type.getResultInc().

Throws:
java.sql.SQLException - if any database error occurs.