/** * Add an alias for an event type represented by Java-bean plain-old Java object events. * @param eventTypeAlias is the alias for the event type * @param eventClass is the Java event class for which to create the alias */ public void addEventTypeAlias(String eventTypeAlias, Class eventClass) { addEventTypeAlias(eventTypeAlias, eventClass.getName()); }
/** * Add an alias for an event type represented by Java-bean plain-old Java object events, * and the alias is the simple class name of the class. * @param eventClass is the Java event class for which to create the alias */ public void addEventTypeAliasSimpleName(Class eventClass) { addEventTypeAlias(eventClass.getSimpleName(), eventClass.getName()); }
private static void handleEventTypes(Configuration configuration, Element element) { String name = element.getAttributes().getNamedItem("alias").getTextContent(); Node classNode = element.getAttributes().getNamedItem("class"); String optionalClassName = null; if (classNode != null) { optionalClassName = classNode.getTextContent(); configuration.addEventTypeAlias(name, optionalClassName); } handleEventTypeDef(name, optionalClassName, configuration, element); }
/** * Add an alias for an event type that represents java.util.Map events, taking a Map of * event property and class name as a parameter. * <p> * This method is provided for convenience and is same in function to method * taking a Properties object that contain fully qualified class name as values. * @param eventTypeAlias is the alias for the event type * @param typeMap maps the name of each property in the Map event to the type of its value in the Map object */ public void addEventTypeAlias(String eventTypeAlias, Map<String, Class> typeMap) { Properties properties = new Properties(); for (Map.Entry<String, Class> entry : typeMap.entrySet()) { properties.put(entry.getKey(), entry.getValue().getName()); } addEventTypeAlias(eventTypeAlias, properties); }
private static void handleMap(String aliasName, Configuration configuration, Element eventTypeElement) { Node superTypesList = eventTypeElement.getAttributes().getNamedItem("supertype-aliases"); if (superTypesList != null) { String value = superTypesList.getTextContent(); String[] aliases = value.split(","); for (String superTypeAlias : aliases) { configuration.addMapSuperType(aliasName, superTypeAlias.trim()); } } Properties propertyTypeNames = new Properties(); NodeList propertyList = eventTypeElement.getElementsByTagName("map-property"); for (int i = 0; i < propertyList.getLength(); i++) { String name = propertyList.item(i).getAttributes().getNamedItem("name").getTextContent(); String clazz = propertyList.item(i).getAttributes().getNamedItem("class").getTextContent(); propertyTypeNames.put(name, clazz); } configuration.addEventTypeAlias(aliasName, propertyTypeNames); }
configuration.addEventTypeAlias(aliasName, className, legacyDesc);
configuration.addEventTypeAlias(aliasName, xmlDOMEventTypeDesc);