[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2055?page=c...
]
Josh Moore commented on HHH-2055:
---------------------------------
Apparently our comments overlapped (diff=3 minutes), no optimistic locking for JIRA
apparently. Anyway by "my approach" I meant how I found the dubious strings,
naturally.
As for the enums, may be userful like CascadeStyle, could even add the interface a la:
public class EventType implements Serializable {
public static final EventType AUTO_FLUSH = new EventType( "auto-flush" ,
AutoFlushEventListener.class );
}
But the look-up via getClassFor(String type) would still require a map with the strings,
and it's just these that I wanted to have. Or the getClassFor method takes an
EventType. What's the chances of dropping that requirement?
Configuration.setListeners() would have to take an EventType, which effects the XML
parsing. Seems messy.
Other possibility is to have Strings and the EventTypes and a Map<String,EventType>
where EventType also has its interface. This could be generated by looping over the enums.
That's be something like:
public EventListeners {
public static class EventType implements Serializable {
private EventType( String name, Class interface, Set typeSet ) {
// ...
typeSet.add( this );
}
}
private static Set types = new HashSet();
public final static EventType AUTO_FLUSH = new
EventType("auto-flush",AutoFlushEventListener.class,types);
//...
}
Add Set<String> EventListeners.getEventTypes() method and
public constants.
---------------------------------------------------------------------------
Key: HHH-2055
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2055
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.2.0.cr4
Reporter: Josh Moore
Assignee: Steve Ebersole
Priority: Trivial
Attachments: cfg_patch.txt, elistener_patch.txt
Since the EventListeners.getListenerClassFor(String type) takes string types, it would be
useful to be able to get these strings, and perhaps even to them available as public final
static String constants. Simplifies programmatic configuration, and allows for easily
detecting if a new event listener type has been added or removed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira