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

## net.java.ao.schema
Class CamelCaseFieldNameConverter

    java.lang.Object
      net.java.ao.schema.AbstractFieldNameConverter
          net.java.ao.schema.CamelCaseFieldNameConverter

All Implemented Interfaces:
  FieldNameConverter

    public class CamelCaseFieldNameConverter

extends AbstractFieldNameConverter

Imposes a standard camelCase convention upon field names. This will convert field in the following way:

Method Name | Returns Entity? | Field Name
getFirstName | `false` | firstName
setLastName | `false` | lastName
getCompany | `true` | companyID
isCool | `false` | cool

This is the default field name converter for ActiveObjects.

Author:
  Daniel Spiewak

Constructor Summary
`CamelCaseFieldNameConverter()`

Method Summary
`protected String` | `convertName(String name, boolean entity, boolean polyType)` Performs the actual conversion logic between a method name (or, more normally a trimmed method name) and the corresponding database field identifier.

Methods inherited from class net.java.ao.schema.AbstractFieldNameConverter
`getName, getPolyTypeName`

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

Constructor Detail

### CamelCaseFieldNameConverter

    public CamelCaseFieldNameConverter()

Method Detail

### convertName

    protected String convertName(String name,
                                 boolean entity,
                                 boolean polyType)

  Description copied from class: `AbstractFieldNameConverter`

  Performs the actual conversion logic between a method name (or, more normally a trimmed method name) and the corresponding database field identifier. This method may impose conventions such as camelCase, all-lowercase with underscores and so on. There is no need for this method to concern itself with method prefixes such as get, set or is. All of these should be handled within the `AbstractFieldNameConverter.getName(Method)` method.

  Some examples of input and their corresponding return values for this method (assuming the `CamelCaseFieldNameConverter` is in use):

  Actual Method Name | Param: name | Param: entity | Param: polyType | Return Value
  getFirstName | FirstName | `false` | `false` | firstName
  getCompany | Company | `true` | `false` | companyID
  getCompany | Company | `true` | `true` | companyType
  isCool | Cool | `false` | `false` | cool
  setLastName | LastName | `false` | `false` | lastName

  The implementation of this method must execute extremely quickly and be totally thread-safe (stateless if possible). This is because this method will be called many times for some operations. A slow algorithm here will dramaticly affect the execution time of basic tasks.

  Specified by:
    `convertName` in class `AbstractFieldNameConverter`
  Parameters:
    `name` - The (often trimmed) method name for which a field name is reqiured.
    `entity` - Indicates whether or not the method in question returns an entity value.
    `polyType` - Indicates whether or not the field in question is a polymorphic type flagging field.
  Returns:
    A valid database field name which uniquely corresponds to the method name in question. Should never return `null`.

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 © 2007-2011. All Rights Reserved.