* Copyright 2007 Daniel Spiewak
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
Represents a strategy for bi-directional mapping between entity types and
their corresponding polymorphic type flag value (if any). The mappings
represented by this strategy will usually be similar, though not
necessarily identical to the values returned by the mono-directional
mapping of entity type to table names (
passable description of polymorphic type flags and relationships is
available in the javadoc for the
An example set of mappings follows (assuming these are all polymorphic types):
|Classname||Polymorphic Type Flag|
Mappings need not be entirely unique, as long as the mappings for all
subtypes of a specific supertype are internally unique. For example, the
above example implies that all three entities are subtypes of a single
Person). Thus, all of the mapping values
must be uniquely paired. However, a fourth entity could just as easily be
represented which extends an entirely separate supertype. Such an entity
would not be constrained to uniqueness with the other, unrelated entities.
However, if the hierarchy for a single supertype does not have fully-defined
and unique mappings, unexpected behavior may result (such as retrieving
references to invalid entities).
A sane implementation (using manually-specified mappings) is implemented
class. Very few use-cases
call for a custom implementation of this interface directly.
typeThe type for which a polymorphic flag must be generated.
parentThe parent interface of the type which must be retrieved.
typeThe polymorphic type flag value which corresponds to the type which must be retrieved.