Class ObjectAccessor

  • Direct Known Subclasses:
    ManyToOneAccessor, OneToOneAccessor, VariableOneToOneAccessor

    public abstract class ObjectAccessor
    extends RelationshipAccessor
    INTERNAL: A single object relationship accessor. Key notes: - any metadata mapped from XML to this class must be compared in the equals method. - any metadata mapped from XML to this class must be handled in the merge method. (merging is done at the accessor/mapping level) - any metadata mapped from XML to this class must be initialized in the initXMLObject method. - methods should be preserved in alphabetical order.
    Since:
    TopLink EJB 3.0 Reference Implementation
    Author:
    Guy Pelletier
    • Method Detail

      • getAttributeType

        public String getAttributeType()
        INTERNAL: The attribute type for virtual object accessors is the target entity.
        Overrides:
        getAttributeType in class MappingAccessor
      • getId

        public Boolean getId()
        INTERNAL:
      • getMapsId

        public String getMapsId()
        INTERNAL: Used for OX mapping.
      • getOptional

        public Boolean getOptional()
        INTERNAL: Used for OX mapping.
      • getReferenceClass

        public MetadataClass getReferenceClass()
        INTERNAL: If a target entity is specified in metadata, it will be set as the reference class, otherwise we will use the raw class.
        Overrides:
        getReferenceClass in class MappingAccessor
      • getSimplePKType

        protected MetadataClass getSimplePKType()
        INTERNAL: Used to process primary keys and DerivedIds.
      • hasAttributeType

        public boolean hasAttributeType()
        INTERNAL: Object accessors don't require a separate attribute-type specification in XML, instead they can use the reference class to determine the attribute-type.
        Overrides:
        hasAttributeType in class MappingAccessor
      • hasId

        protected boolean hasId()
        INTERNAL:
      • hasMapsId

        protected boolean hasMapsId()
        INTERNAL:
      • initManyToOneMapping

        protected ObjectReferenceMapping initManyToOneMapping()
        INTERNAL: Initialize a ManyToOneMapping.
      • initOneToOneMapping

        protected ObjectReferenceMapping initOneToOneMapping()
        INTERNAL: Initialize a OneToOneMapping.
      • isOneToOnePrimaryKeyRelationship

        public boolean isOneToOnePrimaryKeyRelationship()
        INTERNAL: Return true if this accessor represents a 1-1 primary key relationship.
      • isOptional

        public boolean isOptional()
        INTERNAL:
      • processAssociationOverride

        protected void processAssociationOverride​(AssociationOverrideMetadata associationOverride,
                                                  EmbeddableMapping embeddableMapping,
                                                  DatabaseTable defaultTable,
                                                  MetadataDescriptor owningDescriptor)
        INTERNAL: Process an association override for either an embedded object mapping, or a map mapping (element-collection, 1-M and M-M) containing an embeddable object as the value or key.
      • processId

        protected void processId​(OneToOneMapping mapping)
        INTERNAL: Used to process primary keys and DerivedIds.
      • processMapsId

        protected void processMapsId​(OneToOneMapping oneToOneMapping)
        INTERNAL: Process the mapping keys from the maps id value.
      • processMapsIdFields

        protected void processMapsIdFields​(OneToOneMapping oneToOneMapping,
                                           EmbeddedIdAccessor embeddedIdAccessor,
                                           MappingAccessor mapsIdAccessor)
        INTERNAL: We're going to add field name translations where necessary. If the user specified (erroneously that is) attribute overrides this will override them.
      • processForeignKeyRelationship

        protected void processForeignKeyRelationship​(ObjectReferenceMapping mapping)
        INTERNAL: Process the join columns for the owning side of a one to one mapping. The default pk and pk field names are used only with single primary key entities. The processor should never get as far as to use them with entities that have a composite primary key (validation exception will be thrown).
      • processOneToOnePrimaryKeyRelationship

        protected void processOneToOnePrimaryKeyRelationship​(OneToOneMapping mapping)
        INTERNAL: Process the primary key join columns for the owning side of a one to one mapping. The default pk and pk field names are used only with single primary key entities. The processor should never get as far as to use them with entities that have a composite primary key (validation exception will be thrown).
      • processOwningMappingKeys

        protected void processOwningMappingKeys​(OneToOneMapping mapping)
        INTERNAL: Process the the correct metadata for the owning side of a one to one mapping. Note, the order of checking is important, that is, check for a mapsId first.
      • setId

        public void setId​(Boolean id)
        INTERNAL: Used for OX mapping.
      • setMapsId

        public void setMapsId​(String mapsId)
        INTERNAL: Used for OX mapping.
      • setOptional

        public void setOptional​(Boolean isOptional)
        INTERNAL: Used for OX mapping.
      • setPrimaryKeyForeignKey

        public void setPrimaryKeyForeignKey​(PrimaryKeyForeignKeyMetadata primaryKeyForeignKey)
        INTERNAL: Used for OX mapping.