org.apache.commons.betwixt.strategy
Class MappingDerivationStrategy

java.lang.Object
  extended by org.apache.commons.betwixt.strategy.MappingDerivationStrategy

public abstract class MappingDerivationStrategy
extends java.lang.Object

Pluggable strategy determines whether introspection or bind time typing should be used when finding mappings. The type of a property is determined at introspection time but the actual type of the instance can differ at bind time (when the xml is actually being processed). This strategy is used to set (at a per-element level) whether the bind or introspection time type should be used to calculate the mapping to be used.

Note: this strategy is intentionally course. Typically, the best approach is to use a custom strategy to set coursely grained rules (for example: all implemetations of 'IAnimal' use bind time type mapping) and then dot betwixt files to provide refinements.

Since:
0.7
Author:
Apache Commons Team, Apache Software Foundation

Field Summary
static MappingDerivationStrategy DEFAULT
          The default Betwixt strategy.
static MappingDerivationStrategy USE_BIND_TIME_TYPE
          Implementation that always uses bind time type mapping
static MappingDerivationStrategy USE_INTROSPECTION_TIME_TYPE
          Implementation that always uses introspection time type mapping
 
Constructor Summary
MappingDerivationStrategy()
           
 
Method Summary
abstract  boolean useBindTimeTypeForMapping(java.lang.Class propertyType, java.lang.Class singluarPropertyType)
          Should bind time type be used for all elements of the given property type?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_BIND_TIME_TYPE

public static final MappingDerivationStrategy USE_BIND_TIME_TYPE
Implementation that always uses bind time type mapping


USE_INTROSPECTION_TIME_TYPE

public static final MappingDerivationStrategy USE_INTROSPECTION_TIME_TYPE
Implementation that always uses introspection time type mapping


DEFAULT

public static final MappingDerivationStrategy DEFAULT
The default Betwixt strategy.

Constructor Detail

MappingDerivationStrategy

public MappingDerivationStrategy()
Method Detail

useBindTimeTypeForMapping

public abstract boolean useBindTimeTypeForMapping(java.lang.Class propertyType,
                                                  java.lang.Class singluarPropertyType)
Should bind time type be used for all elements of the given property type?

Parameters:
propertyType - Class typing the property, not null
singluarPropertyType - Class composing the collective or null if the property is not collective
Returns:
true if bind time type should be used for the mapping


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.