org.nuiton.topia.persistence.util
Class Collector<R>

java.lang.Object
  extended by org.nuiton.topia.persistence.util.Collector<R>
Type Parameters:
R - les donnes a retourner

public abstract class Collector<R>
extends Object

Un objet qui permet de parcourir des entites (via un Collector.CollectorVisitor) et de collecter des donnees pendant le parcours.

La classe a un type qui est le type de retour de la methode detect(TopiaEntity...).

On peut donc très facilement en faire un collecteur de donnees.

Since:
2.2.0
Author:
tchemit

Nested Class Summary
static class Collector.CollectorVisitor
           
 
Field Summary
protected  TopiaEntityEnum[] contracts
          la liste des contracts des entites connues.
protected  Collector.CollectorVisitor visitor
          le visiteur utiliser pour trouver les types
 
Constructor Summary
Collector(Collector.CollectorVisitor visitor, TopiaEntityEnum[] contracts)
           
Collector(TopiaEntityEnum[] contracts)
           
 
Method Summary
protected  void after(Collector.CollectorVisitor visitor, TopiaEntity entity)
           
protected abstract  R afterAll(Collector.CollectorVisitor visitor, TopiaEntity... entities)
           
protected  void before(Collector.CollectorVisitor visitor, TopiaEntity entity)
           
protected  void beforeAll(Collector.CollectorVisitor visitor, TopiaEntity... entities)
           
protected  void clear()
           
 R detect(TopiaEntity... entities)
           
protected  void finalize()
           
protected  Collection<TopiaEntity> getAlreadyExplored()
           
protected  Class<? extends TopiaEntity> getContractClass(TopiaEntity e)
           
protected  Deque<TopiaEntity> getStack()
           
protected  TopiaEntity getTopiaValue(Object value)
           
protected  void onEnded(TopiaEntity e, boolean enter)
           
protected  boolean onEnding(TopiaEntity e)
           
protected  void onStarted(TopiaEntity e, boolean enter)
           
protected  boolean onStarting(TopiaEntity e)
           
protected  void onVisited(TopiaEntity e, String name, Class<?> collectionType, Class<?> type, int index, Object value, boolean enter)
           
protected  void onVisited(TopiaEntity e, String name, Class<?> collectionType, Class<?> type, Object value, boolean enter)
           
protected  void onVisited(TopiaEntity e, String name, Class<?> type, Object value, boolean enter)
           
protected  boolean onVisiting(TopiaEntity e, String name, Class<?> collectionType, Class<?> type, int index, Object value)
           
protected  boolean onVisiting(TopiaEntity e, String name, Class<?> collectionType, Class<?> type, Object value)
           
protected  boolean onVisiting(TopiaEntity e, String name, Class<?> type, Object value)
           
protected  int stackSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

visitor

protected Collector.CollectorVisitor visitor
le visiteur utiliser pour trouver les types


contracts

protected TopiaEntityEnum[] contracts
la liste des contracts des entites connues.

Constructor Detail

Collector

public Collector(Collector.CollectorVisitor visitor,
                 TopiaEntityEnum[] contracts)

Collector

public Collector(TopiaEntityEnum[] contracts)
Method Detail

clear

protected void clear()

onStarting

protected boolean onStarting(TopiaEntity e)

onStarted

protected void onStarted(TopiaEntity e,
                         boolean enter)

onVisiting

protected boolean onVisiting(TopiaEntity e,
                             String name,
                             Class<?> type,
                             Object value)

onVisited

protected void onVisited(TopiaEntity e,
                         String name,
                         Class<?> type,
                         Object value,
                         boolean enter)

onVisiting

protected boolean onVisiting(TopiaEntity e,
                             String name,
                             Class<?> collectionType,
                             Class<?> type,
                             Object value)

onVisited

protected void onVisited(TopiaEntity e,
                         String name,
                         Class<?> collectionType,
                         Class<?> type,
                         Object value,
                         boolean enter)

onVisiting

protected boolean onVisiting(TopiaEntity e,
                             String name,
                             Class<?> collectionType,
                             Class<?> type,
                             int index,
                             Object value)

onVisited

protected void onVisited(TopiaEntity e,
                         String name,
                         Class<?> collectionType,
                         Class<?> type,
                         int index,
                         Object value,
                         boolean enter)

onEnding

protected boolean onEnding(TopiaEntity e)

onEnded

protected void onEnded(TopiaEntity e,
                       boolean enter)

beforeAll

protected void beforeAll(Collector.CollectorVisitor visitor,
                         TopiaEntity... entities)

before

protected void before(Collector.CollectorVisitor visitor,
                      TopiaEntity entity)

after

protected void after(Collector.CollectorVisitor visitor,
                     TopiaEntity entity)

afterAll

protected abstract R afterAll(Collector.CollectorVisitor visitor,
                              TopiaEntity... entities)

detect

public R detect(TopiaEntity... entities)
         throws TopiaException
Throws:
TopiaException

stackSize

protected int stackSize()

getStack

protected Deque<TopiaEntity> getStack()

getAlreadyExplored

protected Collection<TopiaEntity> getAlreadyExplored()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getContractClass

protected Class<? extends TopiaEntity> getContractClass(TopiaEntity e)

getTopiaValue

protected TopiaEntity getTopiaValue(Object value)


Copyright © 2004-2011 CodeLutin. All Rights Reserved.