Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.access.types
Class AbstractType

    java.lang.Object
      org.apache.cayenne.access.types.AbstractType

All Implemented Interfaces:
  ExtendedType

Direct Known Subclasses:
  ByteArrayType, ByteType, CharType, DefaultType, ShortType, UtilDateType

    public abstract class AbstractType

extends Object
implements ExtendedType

A convenience superclass of ExtendedType implementations. Implements `setJdbcObject(PreparedStatement, Object, int, int, int)`in a generic fashion by calling "setObject(..)" on PreparedStatement. Some adapters may need to override this behavior as it doesn't work consistently across all JDBC drivers.

Author:
  Andrus Adamchik

Constructor Summary
`AbstractType()`

Method Summary
`abstract String` | `getClassName()` Returns a full name of Java class that this ExtendedType supports.
`abstract Object` | `materializeObject(CallableStatement rs, int index, int type)` Reads an object from a stored procedure OUT parameter, converting it to class returned by 'getClassName' method.
`abstract Object` | `materializeObject(ResultSet rs, int index, int type)` Reads an object from JDBC ResultSet column, converting it to class returned by 'getClassName' method.
`void` | `setJdbcObject(PreparedStatement st, Object val, int pos, int type, int precision)` Calls "PreparedStatement.setObject(..)".
`String` | `toString()`
`static boolean` | `validateNull(Object source, String property, Object value, DbAttribute dbAttribute, ValidationResult validationResult)` Deprecated. since 3.0 as validation should not be done at the DataNode level.
`boolean` | `validateProperty(Object source, String property, Object value, DbAttribute dbAttribute, ValidationResult validationResult)` Deprecated. since 3.0 as validation should not be done at the DataNode level.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AbstractType

    public AbstractType()

Method Detail

### validateNull

    public static boolean validateNull(Object source,
                                       String property,
                                       Object value,
                                       DbAttribute dbAttribute,
                                       ValidationResult validationResult)

  Deprecated. since 3.0 as validation should not be done at the DataNode level.

  Helper method for ExtendedType implementors to check for null required values.

  Since:
    1.2

### setJdbcObject

    public void setJdbcObject(PreparedStatement st,
                              Object val,
                              int pos,
                              int type,
                              int precision)
                       throws Exception

  Calls "PreparedStatement.setObject(..)". Some DbAdapters may need to override this behavior for at least some of the object types, as it doesn't work consistently across all JDBC drivers.

  Specified by:
    `setJdbcObject` in interface `ExtendedType`
  Throws:
    `Exception`

### getClassName

    public abstract String getClassName()

  Description copied from interface: `ExtendedType`
  Returns a full name of Java class that this ExtendedType supports.

  Specified by:
    `getClassName` in interface `ExtendedType`

### materializeObject

    public abstract Object materializeObject(CallableStatement rs,
                                             int index,
                                             int type)
                                      throws Exception

  Description copied from interface: `ExtendedType`
  Reads an object from a stored procedure OUT parameter, converting it to class returned by 'getClassName' method.

  Specified by:
    `materializeObject` in interface `ExtendedType`
  Throws:
    `Exception` - if read error ocurred, or an object can't be converted to a target Java class.

### materializeObject

    public abstract Object materializeObject(ResultSet rs,
                                             int index,
                                             int type)
                                      throws Exception

  Description copied from interface: `ExtendedType`
  Reads an object from JDBC ResultSet column, converting it to class returned by 'getClassName' method.

  Specified by:
    `materializeObject` in interface `ExtendedType`
  Throws:
    `Exception` - if read error ocurred, or an object can't be converted to a target Java class.

### validateProperty

    public boolean validateProperty(Object source,
                                    String property,
                                    Object value,
                                    DbAttribute dbAttribute,
                                    ValidationResult validationResult)

  Deprecated. since 3.0 as validation should not be done at the DataNode level.

  Always returns true. Simplifies subclass implementation, as only some of the types can perform the validation.

  Specified by:
    `validateProperty` in interface `ExtendedType`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.