|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.grouper.ObjectGrouperManager
public class ObjectGrouperManager
A global object that can register Object Grouper with a type and a GrouperContext.
Constructor Summary | |
---|---|
ObjectGrouperManager()
|
Method Summary | |
---|---|
static void |
addRegistrationListener(RegistrationListener l)
Adds a listener to the list that's notified each time a change to the manager occurs. |
static void |
clear()
|
static ObjectGrouper |
getGrouper(Class<?> clazz)
Gets the grouper associated with the type. |
static ObjectGrouper |
getGrouper(Class<?> clazz,
GrouperContext context)
Gets the registered grouper associated with class and context. |
static GrouperContext[] |
getGrouperContexts(Class<?> clazz)
Gets the available GrouperContexts registered with the class. |
static Object |
getGroupValue(Object object)
Converts an object to string using default grouper context. |
static Object |
getGroupValue(Object object,
Class<?> clazz)
Converts an object to string using default grouper context. |
static Object |
getGroupValue(Object object,
Class<?> clazz,
GrouperContext context)
Converts an object to string using grouper context specified. |
static RegistrationListener[] |
getRegistrationListeners()
Returns an array of all the registration listeners registered on this manager. |
static void |
initDefaultGrouper()
Initialize default groupers. |
static boolean |
isAutoInit()
Checks the value of autoInit. |
static void |
registerGrouper(Class<?> clazz,
ObjectGrouper grouper)
Registers a grouper with type specified as clazz. |
static void |
registerGrouper(Class<?> clazz,
ObjectGrouper grouper,
GrouperContext context)
Registers a grouper with the type specified as class and a grouper context specified as context. |
static void |
removeRegistrationListener(RegistrationListener l)
Removes a listener from the list that's notified each time a change to the manager occurs. |
static void |
resetInit()
If initDefaultGrouper() is called once, calling it again will have no effect because an internal flag is
set. |
static void |
setAutoInit(boolean autoInit)
Sets autoInit to true or false. |
static void |
unregisterAllGroupers()
Unregisters all the groupers which registered before. |
static void |
unregisterAllGroupers(Class<?> clazz)
Unregisters all groupers associated with clazz. |
static void |
unregisterGrouper(Class<?> clazz)
Unregisters grouper associated with clazz. |
static void |
unregisterGrouper(Class<?> clazz,
GrouperContext context)
Unregisters grouper associated with clazz and context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectGrouperManager()
Method Detail |
---|
public static void registerGrouper(Class<?> clazz, ObjectGrouper grouper, GrouperContext context)
clazz
- typegrouper
- group to be registeredcontext
- the grouper context.public static void registerGrouper(Class<?> clazz, ObjectGrouper grouper)
clazz
- the data type.grouper
- the grouper to be registeredpublic static void unregisterGrouper(Class<?> clazz, GrouperContext context)
clazz
- the data type.context
- the grouper context.public static void unregisterGrouper(Class<?> clazz)
clazz
- the data type.public static void unregisterAllGroupers(Class<?> clazz)
clazz
- the data type.public static void unregisterAllGroupers()
public static ObjectGrouper getGrouper(Class<?> clazz, GrouperContext context)
clazz
- the data type.context
- the grouper context.
public static ObjectGrouper getGrouper(Class<?> clazz)
clazz
- the data type.
public static Object getGroupValue(Object object)
object
- object to be converted.
public static Object getGroupValue(Object object, Class<?> clazz)
object
- object to be converted.clazz
- type of the object
public static Object getGroupValue(Object object, Class<?> clazz, GrouperContext context)
object
- object to be converted.clazz
- type of the objectcontext
- group context
public static boolean isAutoInit()
setAutoInit(boolean)
public static void setAutoInit(boolean autoInit)
initDefaultGrouper()
will be called if it has never be called. By default, autoInit is true.
This might affect the behavior if users provide their own groupers and want to overwrite default groupers. In
this case, instead of depending on autoInit to initialize default groupers, you should call initDefaultGrouper()
first, then call registerGrouper to add your own groupers.
autoInit
- false if you want to disable autoInit which means you either don't want those default comparators
registered or you will call initDefaultGrouper()
yourself.public static void addRegistrationListener(RegistrationListener l)
l
- the RegistrationListenerpublic static void removeRegistrationListener(RegistrationListener l)
l
- the RegistrationListenerpublic static RegistrationListener[] getRegistrationListeners()
RegistrationListener
s or an empty array if no registration
listeners are currently registeredaddRegistrationListener(com.jidesoft.utils.RegistrationListener)
,
removeRegistrationListener(com.jidesoft.utils.RegistrationListener)
public static GrouperContext[] getGrouperContexts(Class<?> clazz)
clazz
- the class.
public static void initDefaultGrouper()
DateYearGrouper dateYearGrouper = new DateYearGrouper();
registerGrouper(Date.class, dateYearGrouper, DateYearGrouper.CONTEXT);
registerGrouper(Calendar.class, dateYearGrouper, DateYearGrouper.CONTEXT);
registerGrouper(Long.class, dateYearGrouper, DateYearGrouper.CONTEXT);
DateMonthGrouper dateMonthGrouper = new DateMonthGrouper();
registerGrouper(Date.class, dateMonthGrouper, DateMonthGrouper.CONTEXT);
registerGrouper(Calendar.class, dateMonthGrouper, DateMonthGrouper.CONTEXT);
registerGrouper(Long.class, dateMonthGrouper, DateMonthGrouper.CONTEXT);
public static void resetInit()
initDefaultGrouper()
is called once, calling it again will have no effect because an internal flag is
set. This method will reset the internal flag so that you can call initDefaultGrouper()
in case you
unregister all groupers using unregisterAllGroupers()
.
public static void clear()
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |