info.aduna.gee.spectacle.gee
Interface Classifier

All Known Subinterfaces:
FacetClassifier, MasterFacetClassifier
All Known Implementing Classes:
AbstractByClassificationClassifier, AbstractByEntityClassifier, AbstractFacetByClassificationClassifier, AbstractFacetClassifier, AbstractMasterFacetClassifier, DefaultClassifier, FacetLevelClassifier, LanguageClassifier, LocationClassifier, MimeTypeClassifier, PeopleClassifier, SizeClassifier, SourceClassifier, TimeClassifier

public interface Classifier

Classifier is the interface for objects that know how to classify Entities. A single "classification" for an Entity may be any type. It can be, it is not required to be a String. In real life projects, classification by native domain types has proved to be very powerful. The types used for classification must support:

                
  1. hashCode() -- and not Object's hashCode()
  2. equals() -- and not Object's equals()
Wherever a String representation of a classification is required, the classification's "toString()" is used. A classifier can attach multiple classifications to a single Entity, and it does not make sense to add the same classification twice for an Entity. Therefore, classifications are collected in Sets. The most common (by Entity) classifiers return a single set per object, containing all classification for the object. These classifiers have depth 1. However, sometimes it is more effective to return different, though related, classifications. Think of e.g. country/region of travel objects. Such classifiers have a depth greater than 1. Regardless of the depth, (by Entity) classifiers always returns a List of Sets of classifications.


Field Summary
static Object BY_CLASSIFICATION
           
static Object BY_ENTITY
           
 
Method Summary
 Object getAccessMethod()
           
 Set<Object> getClassifications(int level)
           
 List<Set<Object>> getClassifications(Object entityID)
           
 int getDepth()
           
 Set<Object> getEntityIDs(Object classification, int level)
           
 

Field Detail

BY_CLASSIFICATION

static final Object BY_CLASSIFICATION

BY_ENTITY

static final Object BY_ENTITY
Method Detail

getDepth

int getDepth()
Returns:
the depth

getAccessMethod

Object getAccessMethod()
Returns:
one of BY_CLASSIFICATION, BY_ENTITY

getClassifications

Set<Object> getClassifications(int level)
Parameters:
level - the level (0 based)
Returns:
a set of Classifications only used for BY_CLASSIFICATION

getEntityIDs

Set<Object> getEntityIDs(Object classification,
                         int level)
Parameters:
classification - the classification
level - the level of the classification (0 based)
Returns:
a set of Object Entity ids only used for BY_CLASSIFICATION

getClassifications

List<Set<Object>> getClassifications(Object entityID)
Parameters:
entityID - a unique identifier of an Entity
Returns:
a List of sets of Classifications only used for BY_ENTITY


Copyright © 1997-2008 Aduna. All Rights Reserved.