Class AnnotationLoaderUtil

    • Constructor Detail

      • AnnotationLoaderUtil

        public AnnotationLoaderUtil​(DbControl dc,
                                    SnapshotManager manager,
                                    AnnotationType at)
        Create a loder that uses the given snapshot manager to load annotations for a single annotation type. The loader will load only primary annotations.
      • AnnotationLoaderUtil

        public AnnotationLoaderUtil​(DbControl dc,
                                    SnapshotManager manager,
                                    AnnotationType at,
                                    boolean searchPrimary,
                                    boolean searchInherited)
        Create a loder that uses the given snapshot manager to load annotations for a single annotation type. The loader can be configured to load primary and/or inherited annotations.
        Since:
        3.5
    • Method Detail

      • evaluate

        public boolean evaluate​(AnnotationSnapshot snapshot)
        Description copied from interface: Filter
        Evaluate if the given object should pass the filter or not.
        Specified by:
        evaluate in interface Filter<AnnotationSnapshot>
        Parameters:
        snapshot - The object to evaluate
        Returns:
        TRUE if the object passes the filter, FALSE otherwise
      • getId

        public int getId()
        The ID of the annotation type that this loader load annotations from.
      • getAnnotationType

        public AnnotationType getAnnotationType()
        The annotation type that this loader load annotations from.
      • isSearchingPrimaryAnnotations

        public boolean isSearchingPrimaryAnnotations()
        Is this loader searching for primary annotations?
        Since:
        3.5
      • isSearchingInheritedAnnotations

        public boolean isSearchingInheritedAnnotations()
        Is this loader searching for inherited annotations?
        Since:
        3.5
      • findAll

        public int findAll​(AnnotationSetSnapshot setSnapshot)
        Find and load annotations from the given annotation set snapshot.
        Returns:
        The number of snapshots found
        Since:
        3.5
      • findAll

        public int findAll​(AnnotationSetSnapshot setSnapshot,
                           Filter<AnnotationSnapshot> filter)
        Find and load annotations from the given annotation set snapshot using an optional extra filter.
        Returns:
        The number of snapshots found
        Since:
        3.11
      • getSnapshot

        public AnnotationSnapshot getSnapshot()
        Get the snapshot for the last annotation found when calling findAll(AnnotationSetSnapshot). Note! If multiple annotation snapshots were found, this will only return the first hit.
        Returns:
        A snapshot or null if no annotations are found
      • getValues

        public List<? extends Serializable> getValues()
        Get the values from the last annotation found when calling find(AnnotationSetSnapshot)
        Returns:
        A list of annotation values or null if no annotations are found
      • getUnit

        public Unit getUnit()
        Get the unit of the last annotation values that was found by find(AnnotationSetSnapshot). Note that if multiple annotations was found with different units the default unit of the annotation type is used.
        Returns:
        A string or null if the annotation doesn't use units
      • getUnitSymbol

        public String getUnitSymbol()
        Get the unit symbol of the last annotation values that was found by find(AnnotationSetSnapshot).
        Returns:
        A string or null if the annotation doesn't use units