private static void addJcrPrimaryNodeTypeClassPair(Map<String, Class<? extends HippoBean>> jcrPrimaryNodeTypeClassPairs, Class clazz, boolean builtinType) throws HstComponentException { String jcrPrimaryNodeType = null; if (clazz.isAnnotationPresent(Node.class)) { Node anno = (Node) clazz.getAnnotation(Node.class); jcrPrimaryNodeType = anno.jcrType(); } if (jcrPrimaryNodeTypeClassPairs.get(jcrPrimaryNodeType) != null) { if (!builtinType) { throw new HstComponentFatalException("Annotated class for primarytype '"+jcrPrimaryNodeType+"' is duplicate. " + "You might have configured a bean in 'beans-annotated-classes.xml' that does not have a annotation for the jcrType and" + "inherits the jcrType from the bean it extends, resulting in 2 beans with the same jcrType. Correct your beans."); } return; } if (jcrPrimaryNodeType == null) { throw new IllegalArgumentException("There's no annotation for jcrType in the class: " + clazz); } jcrPrimaryNodeTypeClassPairs.put(jcrPrimaryNodeType,clazz); }
private static void addJcrPrimaryNodeTypeClassPair(Map<String, Class<? extends HippoBean>> jcrPrimaryNodeTypeClassPairs, Class clazz, boolean builtinType) throws HstComponentException { String jcrPrimaryNodeType = null; if (clazz.isAnnotationPresent(Node.class)) { Node anno = (Node) clazz.getAnnotation(Node.class); jcrPrimaryNodeType = anno.jcrType(); } if(jcrPrimaryNodeTypeClassPairs.get(jcrPrimaryNodeType) != null) { if(builtinType) { log.debug("Builtin annotated class for primary type '{}' is overridden. Builtin version is ignored", jcrPrimaryNodeType); } else { throw new HstComponentFatalException("Annotated class for primarytype '"+jcrPrimaryNodeType+"' is duplicate. " + "You might have configured a bean in 'beans-annotated-classes.xml' that does not have a annotation for the jcrType and" + "inherits the jcrType from the bean it extends, resulting in 2 beans with the same jcrType. Correct your beans."); } return; } if (jcrPrimaryNodeType == null) { throw new IllegalArgumentException("There's no annotation for jcrType in the class: " + clazz); } jcrPrimaryNodeTypeClassPairs.put(jcrPrimaryNodeType,clazz); }