@Override public void validate() throws BeanDefinitionValidationException { super.validate(); if (this.parentName == null) { throw new BeanDefinitionValidationException("'parentName' must be set in ChildBeanDefinition"); } }
@Nullable private Method determineDestroyMethod(String name) { try { if (System.getSecurityManager() != null) { return AccessController.doPrivileged((PrivilegedAction<Method>) () -> findDestroyMethod(name)); } else { return findDestroyMethod(name); } } catch (IllegalArgumentException ex) { throw new BeanDefinitionValidationException("Could not find unique destroy method on bean with name '" + this.beanName + ": " + ex.getMessage()); } }
@Override public void validate() throws BeanDefinitionValidationException { super.validate(); if (this.parentName == null) { throw new BeanDefinitionValidationException("'parentName' must be set in ChildBeanDefinition"); } }
private static String checkAttribute(String attributeName, String attribute) { if (Strings.isNullOrEmpty(attribute)) { throw new BeanDefinitionValidationException("Attribute [" + attributeName + "] is required."); } return attribute; } }
private static String checkAttribute(String attributeName, String attribute) { if (Strings.isNullOrEmpty(attribute)) { throw new BeanDefinitionValidationException("Attribute [" + attributeName + "] is required."); } return attribute; } }
@Nullable private Method determineDestroyMethod(String name) { try { if (System.getSecurityManager() != null) { return AccessController.doPrivileged((PrivilegedAction<Method>) () -> findDestroyMethod(name)); } else { return findDestroyMethod(name); } } catch (IllegalArgumentException ex) { throw new BeanDefinitionValidationException("Could not find unique destroy method on bean with name '" + this.beanName + ": " + ex.getMessage()); } }
throw new BeanDefinitionValidationException("Could not find an init method named '" + initMethodName + "' on bean with name '" + beanName + "'");
if (this.destroyMethod == null) { if (beanDefinition.isEnforceDestroyMethod()) { throw new BeanDefinitionValidationException("Could not find a destroy method named '" + destroyMethodName + "' on bean with name '" + beanName + "'"); Class<?>[] paramTypes = this.destroyMethod.getParameterTypes(); if (paramTypes.length > 1) { throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + beanName + "' has more than one parameter - not supported as destroy method"); throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + beanName + "' has a non-boolean parameter - not supported as destroy method");
/** * Validate this bean definition. * @throws BeanDefinitionValidationException in case of validation failure */ public void validate() throws BeanDefinitionValidationException { if (hasMethodOverrides() && getFactoryMethodName() != null) { throw new BeanDefinitionValidationException( "Cannot combine static factory method with method overrides: " + "the static factory method must create the instance"); } if (hasBeanClass()) { prepareMethodOverrides(); } }
throw new BeanDefinitionValidationException("Could not find an init method named '" + initMethodName + "' on bean with name '" + beanName + "'");
if (this.destroyMethod == null) { if (beanDefinition.isEnforceDestroyMethod()) { throw new BeanDefinitionValidationException("Could not find a destroy method named '" + destroyMethodName + "' on bean with name '" + beanName + "'"); Class<?>[] paramTypes = this.destroyMethod.getParameterTypes(); if (paramTypes.length > 1) { throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + beanName + "' has more than one parameter - not supported as destroy method"); throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + beanName + "' has a non-boolean parameter - not supported as destroy method");
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { if (beanClass == JupiterSpringServer.class) { return parseJupiterServer(element, parserContext); } else if (beanClass == JupiterSpringClient.class) { return parseJupiterClient(element, parserContext); } else if (beanClass == JupiterSpringProviderBean.class) { return parseJupiterProvider(element, parserContext); } else if (beanClass == JupiterSpringConsumerBean.class) { return parseJupiterConsumer(element, parserContext); } else { throw new BeanDefinitionValidationException("Unknown class to definition: " + beanClass.getName()); } }
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { if (beanClass == JupiterSpringServer.class) { return parseJupiterServer(element, parserContext); } else if (beanClass == JupiterSpringClient.class) { return parseJupiterClient(element, parserContext); } else if (beanClass == JupiterSpringProviderBean.class) { return parseJupiterProvider(element, parserContext); } else if (beanClass == JupiterSpringConsumerBean.class) { return parseJupiterConsumer(element, parserContext); } else { throw new BeanDefinitionValidationException("Unknown class to definition: " + beanClass.getName()); } }
/** * Validate this bean definition. * @throws BeanDefinitionValidationException in case of validation failure */ public void validate() throws BeanDefinitionValidationException { if (hasMethodOverrides() && getFactoryMethodName() != null) { throw new BeanDefinitionValidationException( "Cannot combine static factory method with method overrides: " + "the static factory method must create the instance"); } if (hasBeanClass()) { prepareMethodOverrides(); } }
/** * Validate and prepare the given method override. * Checks for existence of a method with the specified name, * marking it as not overloaded if none found. * @param mo the MethodOverride object to validate * @throws BeanDefinitionValidationException in case of validation failure */ protected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException { int count = ClassUtils.getMethodCountForName(getBeanClass(), mo.getMethodName()); if (count == 0) { throw new BeanDefinitionValidationException( "Invalid method override: no method with name '" + mo.getMethodName() + "' on class [" + getBeanClassName() + "]"); } else if (count == 1) { // Mark override as not overloaded, to avoid the overhead of arg type checking. mo.setOverloaded(false); } }
String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE); if (proxyTargetClass && (language == null || !language.equals("groovy"))) { throw new BeanDefinitionValidationException( "Cannot use proxyTargetClass=true with script beans where language is not 'groovy': '" + language + "'");
String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE); if (proxyTargetClass && (language == null || !language.equals("groovy"))) { throw new BeanDefinitionValidationException( "Cannot use proxyTargetClass=true with script beans where language is not 'groovy': '" + language + "'");
/** * Validate and prepare the given method override. * Checks for existence of a method with the specified name, * marking it as not overloaded if none found. * @param mo the MethodOverride object to validate * @throws BeanDefinitionValidationException in case of validation failure */ protected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException { int count = ClassUtils.getMethodCountForName(getBeanClass(), mo.getMethodName()); if (count == 0) { throw new BeanDefinitionValidationException( "Invalid method override: no method with name '" + mo.getMethodName() + "' on class [" + getBeanClassName() + "]"); } else if (count == 1) { // Mark override as not overloaded, to avoid the overhead of arg type checking. mo.setOverloaded(false); } }
@Override public void validate() throws BeanDefinitionValidationException { super.validate(); if (this.parentName == null) { throw new BeanDefinitionValidationException("'parentName' must be set in ChildBeanDefinition"); } }
private void validate(RocketMQMessageListener annotation) { if (annotation.consumeMode() == ConsumeMode.ORDERLY && annotation.messageModel() == MessageModel.BROADCASTING) throw new BeanDefinitionValidationException("Bad annotation definition in @RocketMQMessageListener, messageModel BROADCASTING does not support ORDERLY message!"); } }