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.cocoon.forms.datatype.typeimpl
Class AbstractDatatype

    java.lang.Object
      org.apache.cocoon.forms.datatype.typeimpl.AbstractDatatype

All Implemented Interfaces:
  Datatype

Direct Known Subclasses:
  BeanType, BooleanType, CharType, DateType, DecimalType, DoubleType, EnumType, FloatType, IntegerType, LongType, StringType

public abstract class AbstractDatatype
extends Object
implements Datatype

Abstract base class for Datatype implementations. Most concreate datatypes will derive from this class.

Version:
  $Id: AbstractDatatype.java 587759 2007-10-24 03:00:37Z vgritsenko $

Constructor Summary
`AbstractDatatype()`

Method Summary
`void` | `addValidationRule(ValidationRule validationRule)`
`ConversionResult` | `convertFromString(String value, Locale locale)` Converts a string to an object of this datatype.
`String` | `convertToString(Object value, Locale locale)` Converts an object of this datatype to a string representation.
`void` | `generateSaxFragment(ContentHandler contentHandler, Locale locale)` Generates a bit of information about this datatype.
`DatatypeBuilder` | `getBuilder()` Returns the factory that built this datatype.
`Convertor` | `getConvertor()` Returns the convertor used by this datatype.
`Convertor` | `getPlainConvertor()` Returns the "plain convertor".
`boolean` | `isArrayType()` Indicates wether this datatype represents an array type.
`protected void` | `setArrayType(boolean arrayType)`
`protected void` | `setBuilder(DatatypeBuilder builder)`
`void` | `setConvertor(Convertor convertor)`
`ValidationError` | `validate(Object value, org.outerj.expression.ExpressionContext expressionContext)` Returns null if validation is successful, otherwise returns a `ValidationError` instance.

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

Methods inherited from interface org.apache.cocoon.forms.datatype.Datatype
`getDescriptiveName, getTypeClass`

Constructor Detail

### AbstractDatatype

    public AbstractDatatype()

Method Detail

### validate

    public ValidationError validate(Object value,
                                    org.outerj.expression.ExpressionContext expressionContext)

  Description copied from interface: `Datatype`
  Returns null if validation is successful, otherwise returns a `ValidationError` instance.

  Specified by:
    `validate` in interface `Datatype`
  Parameters:
    `value` - an Object of the correct type for this datatype (see `Datatype.getTypeClass()`, or if `Datatype.isArrayType()` returns true, an array of objects of that type.

### addValidationRule

    public void addValidationRule(ValidationRule validationRule)

### isArrayType

    public boolean isArrayType()

  Description copied from interface: `Datatype`
  Indicates wether this datatype represents an array type. This approach has been chosen instead of creating a seperate ArrayDatatype interface (and corresponding implementations), since almost all functionality is the same between the scalar and array types. The main difference is that the validate() method will be passed arrays instead of single values, and hence different validation rules will be required.

  Specified by:
    `isArrayType` in interface `Datatype`

### setArrayType

    protected void setArrayType(boolean arrayType)

### setConvertor

    public void setConvertor(Convertor convertor)

### setBuilder

    protected void setBuilder(DatatypeBuilder builder)

### getPlainConvertor

    public Convertor getPlainConvertor()

  Description copied from interface: `Datatype`
  Returns the "plain convertor". This is convertor that should have a locale-independent string encoding, and guarantees perfect roundtripping. It is used if a value of this datatype needs to be stored but not displayed to the user.

  Specified by:
    `getPlainConvertor` in interface `Datatype`

### getBuilder

    public DatatypeBuilder getBuilder()

  Description copied from interface: `Datatype`
  Returns the factory that built this datatype.

  Specified by:
    `getBuilder` in interface `Datatype`

### getConvertor

    public Convertor getConvertor()

  Description copied from interface: `Datatype`
  Returns the convertor used by this datatype.

  Specified by:
    `getConvertor` in interface `Datatype`

### convertFromString

    public ConversionResult convertFromString(String value,
                                              Locale locale)

  Description copied from interface: `Datatype`
  Converts a string to an object of this datatype. This method uses the same `Convertor` as returned by the `Datatype.getConvertor()` method.

  Specified by:
    `convertFromString` in interface `Datatype`

### convertToString

    public String convertToString(Object value,
                                  Locale locale)

  Description copied from interface: `Datatype`
  Converts an object of this datatype to a string representation. This method uses the same `Convertor` as returned by the `Datatype.getConvertor()` method.

  Specified by:
    `convertToString` in interface `Datatype`

### generateSaxFragment

    public void generateSaxFragment(ContentHandler contentHandler,
                                    Locale locale)
                             throws SAXException

  Description copied from interface: `Datatype`
  Generates a bit of information about this datatype.

  Specified by:
    `generateSaxFragment` in interface `Datatype`
  Throws:
    `SAXException`

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 © 1999-2008 The Apache Software Foundation. All Rights Reserved.