Class EntityDescriptor

java.lang.Object
cz.cvut.kbss.jopa.model.descriptors.AbstractDescriptor
cz.cvut.kbss.jopa.model.descriptors.EntityDescriptor
All Implemented Interfaces:
Descriptor

public class EntityDescriptor extends AbstractDescriptor
Describes an entity.

Each attribute has a descriptor associated with it.

  • Constructor Details

    • EntityDescriptor

      public EntityDescriptor()
    • EntityDescriptor

      public EntityDescriptor(boolean assertionsInSubjectContext)
      Allows configuring where object property assertions should be stored
      Parameters:
      assertionsInSubjectContext - Whether object property assertions are stored in the subject's. Defaults to true. If false, object property assertions are stored in the object's context
      See Also:
    • EntityDescriptor

      public EntityDescriptor(URI context)
    • EntityDescriptor

      public EntityDescriptor(Set<URI> contexts)
    • EntityDescriptor

      public EntityDescriptor(URI context, boolean assertionsInSubjectContext)
    • EntityDescriptor

      protected EntityDescriptor(Set<URI> contexts, boolean assertionsInSubjectContext, String language, boolean hasLanguage, boolean includeInferred, Map<Field,Descriptor> fieldDescriptors)
  • Method Details

    • addAttributeDescriptor

      public EntityDescriptor addAttributeDescriptor(FieldSpecification<?,?> attribute, Descriptor descriptor)
      Description copied from interface: Descriptor
      Adds descriptor for the specified attribute.

      If a descriptor already exists for the specified attribute, it is overridden by the new one.

      Parameters:
      attribute - The attribute to set descriptor for
      descriptor - The descriptor to use
      Returns:
      This instance
    • addAttributeContext

      public EntityDescriptor addAttributeContext(FieldSpecification<?,?> attribute, URI context)
      Description copied from interface: Descriptor
      Adds repository context for the specified attribute.

      This in effect means creating a descriptor (if it does not already exist) for the specified field and adding the specified context to it.

      Parameters:
      attribute - The attribute to set context for
      context - The context to set
      Returns:
      This instance
      See Also:
    • setLanguage

      public EntityDescriptor setLanguage(String languageTag)
      Description copied from interface: Descriptor
      Sets language tag of this descriptor.

      Applies to any possible sub-descriptors as well.

      Specified by:
      setLanguage in interface Descriptor
      Overrides:
      setLanguage in class AbstractDescriptor
      Parameters:
      languageTag - The language tag to use, possibly null, meaning no language preference should be used
      Returns:
      This instance
      See Also:
    • setAttributeLanguage

      public EntityDescriptor setAttributeLanguage(FieldSpecification<?,?> attribute, String languageTag)
      Description copied from interface: Descriptor
      Sets language to be used when working (retrieving, persisting) with values of the specified attribute.

      Note that setting language in this manner will not have any effect on descriptors of the specified attribute previously retrieved from this descriptor.

      Parameters:
      attribute - The attribute concerned
      languageTag - Language tag to use, possibly null
      Returns:
      This instance
    • getAttributeDescriptor

      public Descriptor getAttributeDescriptor(FieldSpecification<?,?> attribute)
      Description copied from interface: Descriptor
      Gets descriptor for the specified attribute.
      Parameters:
      attribute - Entity attribute, as specified by the application metamodel
      Returns:
      Descriptor
    • getAttributeContexts

      public Set<URI> getAttributeContexts(FieldSpecification<?,?> attribute)
      Description copied from interface: Descriptor
      Gets contexts in which the property assertion(s) of the specified attribute are stored.

      If none are specified for the attribute, contexts of this descriptor are returned.

      Note that for saving a property assertion, there must be at most one context.

      Parameters:
      attribute - Entity attribute, as specified by the application model
      Returns:
      Context identifiers
    • getAttributeDescriptors

      public Collection<Descriptor> getAttributeDescriptors()
      Description copied from interface: Descriptor
      Gets attribute descriptors specified in this descriptor.
      Returns:
      Unmodifiable view of attribute descriptors
    • copy

      public EntityDescriptor copy()
      Description copied from interface: Descriptor
      Creates a copy of this descriptor.
      Returns:
      New descriptor with identical values
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class AbstractDescriptor
    • equals

      protected boolean equals(Object other, Map<AbstractDescriptor.VisitedPair,Boolean> visited)
      Overrides:
      equals in class AbstractDescriptor
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractDescriptor
    • hashCode

      protected int hashCode(Map<Object,Boolean> visited)
      Overrides:
      hashCode in class AbstractDescriptor