## org.eclipse.emf.ecore.xmi.impl
Class ElementHandlerImpl

    java.lang.Object
      org.eclipse.emf.ecore.xmi.impl.ElementHandlerImpl

All Implemented Interfaces:
  XMLResource.ElementHandler

    public class ElementHandlerImpl

extends java.lang.Object
implements XMLResource.ElementHandler

An implementation of an element handler that includes support for searching for features in a specified collection of packages as well as optional support for searching for substitution group features for super types of the specified type.

See Also:
  `XMLResource.OPTION_ELEMENT_HANDLER`

Field Summary
`protected boolean` `considerSubtypes`
`protected java.util.Collection<? extends EPackage>` `ePackages`

Constructor Summary
`ElementHandlerImpl(boolean considerSubtypes)` Creates a default instances.
`ElementHandlerImpl(boolean considerSubtypes, java.util.Collection<? extends EPackage> ePackages)` Creates an instance that will search the given packages for candidate features.

Method Summary
`EStructuralFeature` `getRoot(ExtendedMetaData extendedMetaData, EClassifier eClassifier)` Returns an appropriate feature for serializing a value of the give type.
`protected EStructuralFeature` `getSubstitutionGroup(ExtendedMetaData extendedMetaData, EPackage ePackage, EClass eContainingClass, EStructuralFeature eStructuralFeature, EClassifier eClassifier)` Searches the document root object package for a changeable (non-abstract) element that is affiliated with the given feature in the given class and a classifier that exactly matches the given classifier
`EStructuralFeature` `getSubstitutionGroup(ExtendedMetaData extendedMetaData, EStructuralFeature eStructuralFeature, EClassifier eClassifier)` Returns an feature, related by `substitution group affiliation` to the given feature, for serializing a value of the give type.
`protected EClassifier` `getSuperType(ExtendedMetaData extendedMetaData, EClassifier eClassifier)` Returns the `base type` or first `super type` of the classifier, depending on there it is a `data type` or a `class`.

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

Field Detail

### considerSubtypes

    protected boolean considerSubtypes

### ePackages

    protected java.util.Collection<? extends EPackage> ePackages

Constructor Detail

### ElementHandlerImpl

    public ElementHandlerImpl(boolean considerSubtypes)

  Creates a default instances.

  Parameters:
    `considerSubtypes` - whether to consider `base types` or `super types` when finding a substitution group.

### ElementHandlerImpl

    public ElementHandlerImpl(boolean considerSubtypes,
                              java.util.Collection<? extends EPackage> ePackages)

  Creates an instance that will search the given packages for candidate features.

  Parameters:
    `considerSubtypes` - whether to consider `base types` or `super types` when finding a substitution group.
    `ePackages` - the packages to search for candidates.

Method Detail

### getRoot

    public EStructuralFeature getRoot(ExtendedMetaData extendedMetaData,
                                      EClassifier eClassifier)

  Description copied from interface: `XMLResource.ElementHandler`
  Returns an appropriate feature for serializing a value of the give type.

  Specified by:
    `getRoot` in interface `XMLResource.ElementHandler`
  Parameters:
    `extendedMetaData` - the extended meta data in which to look up type information.
    `eClassifier` - the type of value to serialize.
  Returns:
    an appropriate feature for serializing a value of the give type or `null`.

### getSuperType

    protected EClassifier getSuperType(ExtendedMetaData extendedMetaData,
                                       EClassifier eClassifier)

  Returns the `base type` or first `super type` of the classifier, depending on there it is a `data type` or a `class`.

  Parameters:
    `extendedMetaData` - the extended meta data in which to look up type information.
    `eClassifier` - the classifier in question.
  Returns:
    the `base type`, the first `super type` of the classifier, or `null`.

### getSubstitutionGroup

    public EStructuralFeature getSubstitutionGroup(ExtendedMetaData extendedMetaData,
                                                   EStructuralFeature eStructuralFeature,
                                                   EClassifier eClassifier)

  Description copied from interface: `XMLResource.ElementHandler`
  Returns an feature, related by `substitution group affiliation` to the given feature, for serializing a value of the give type.

  Specified by:
    `getSubstitutionGroup` in interface `XMLResource.ElementHandler`
  Parameters:
    `extendedMetaData` - the extended meta data in which to look up type information.
    `eStructuralFeature` - the feature that will be used if this method returns null.
    `eClassifier` - the type of value to serialize.
  Returns:
    an appropriate feature for serializing a value of the give type or `null`.

### getSubstitutionGroup

    protected EStructuralFeature getSubstitutionGroup(ExtendedMetaData extendedMetaData,
                                                      EPackage ePackage,
                                                      EClass eContainingClass,
                                                      EStructuralFeature eStructuralFeature,
                                                      EClassifier eClassifier)

  Searches the document root object package for a changeable (non-abstract) element that is affiliated with the given feature in the given class and a classifier that exactly matches the given classifier

  Parameters:
    `extendedMetaData` - the extended meta data in which to look up type information.
    `ePackage` - the package whose document root to search.
    `eContainingClass` - the containing class of the feature.
    `eStructuralFeature` - the target feature.
    `eClassifier` - the type of object being matched.
  Returns:
    the substitution group feature or `null`.

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.