Java Code Examples for org.springframework.beans.factory.support.ManagedList#isEmpty()

The following examples show how to use org.springframework.beans.factory.support.ManagedList#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AspectJAutoProxyBeanDefinitionParser.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
	ManagedList<TypedStringValue> includePatterns = new ManagedList<>();
	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node node = childNodes.item(i);
		if (node instanceof Element) {
			Element includeElement = (Element) node;
			TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
			valueHolder.setSource(parserContext.extractSource(includeElement));
			includePatterns.add(valueHolder);
		}
	}
	if (!includePatterns.isEmpty()) {
		includePatterns.setSource(parserContext.extractSource(element));
		beanDef.getPropertyValues().add("includePatterns", includePatterns);
	}
}
 
Example 2
Source File: ResourcesBeanDefinitionParser.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private void parseResourceChain(
		RootBeanDefinition resourceHandlerDef, ParserContext context, Element element, @Nullable Object source) {

	String autoRegistration = element.getAttribute("auto-registration");
	boolean isAutoRegistration = !(StringUtils.hasText(autoRegistration) && "false".equals(autoRegistration));

	ManagedList<Object> resourceResolvers = new ManagedList<>();
	resourceResolvers.setSource(source);
	ManagedList<Object> resourceTransformers = new ManagedList<>();
	resourceTransformers.setSource(source);

	parseResourceCache(resourceResolvers, resourceTransformers, element, source);
	parseResourceResolversTransformers(
			isAutoRegistration, resourceResolvers, resourceTransformers, context, element, source);

	if (!resourceResolvers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceResolvers", resourceResolvers);
	}
	if (!resourceTransformers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceTransformers", resourceTransformers);
	}
}
 
Example 3
Source File: AspectJAutoProxyBeanDefinitionParser.java    From java-technology-stack with MIT License 6 votes vote down vote up
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
	ManagedList<TypedStringValue> includePatterns = new ManagedList<>();
	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node node = childNodes.item(i);
		if (node instanceof Element) {
			Element includeElement = (Element) node;
			TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
			valueHolder.setSource(parserContext.extractSource(includeElement));
			includePatterns.add(valueHolder);
		}
	}
	if (!includePatterns.isEmpty()) {
		includePatterns.setSource(parserContext.extractSource(element));
		beanDef.getPropertyValues().add("includePatterns", includePatterns);
	}
}
 
Example 4
Source File: ResourcesBeanDefinitionParser.java    From java-technology-stack with MIT License 6 votes vote down vote up
private void parseResourceChain(
		RootBeanDefinition resourceHandlerDef, ParserContext context, Element element, @Nullable Object source) {

	String autoRegistration = element.getAttribute("auto-registration");
	boolean isAutoRegistration = !(StringUtils.hasText(autoRegistration) && "false".equals(autoRegistration));

	ManagedList<Object> resourceResolvers = new ManagedList<>();
	resourceResolvers.setSource(source);
	ManagedList<Object> resourceTransformers = new ManagedList<>();
	resourceTransformers.setSource(source);

	parseResourceCache(resourceResolvers, resourceTransformers, element, source);
	parseResourceResolversTransformers(
			isAutoRegistration, resourceResolvers, resourceTransformers, context, element, source);

	if (!resourceResolvers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceResolvers", resourceResolvers);
	}
	if (!resourceTransformers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceTransformers", resourceTransformers);
	}
}
 
Example 5
Source File: AbstractInterfaceBeanDefinitionParser.java    From joyrpc with Apache License 2.0 6 votes vote down vote up
@Override
public void parse(final BeanDefinition definition, final String id, final Element element, final String name,
                  final ParserContext context) {
    NodeList nodes = element.getChildNodes();
    if (nodes != null && nodes.getLength() > 0) {
        ManagedList methods = new ManagedList();
        Node node;
        String methodName;
        MethodBeanDefinitionParser parser = new MethodBeanDefinitionParser();
        for (int i = 0; i < nodes.getLength(); i++) {
            node = nodes.item(i);
            if (node instanceof Element && (METHOD.equals(node.getNodeName()) || METHOD.equals(node.getLocalName()))) {
                methodName = ((Element) node).getAttribute("name");
                if (isEmpty(methodName)) {
                    throw new IllegalStateException("method name attribute == null");
                }
                methods.add(new BeanDefinitionHolder(
                        parser.parse(((Element) node), context), id + "." + methodName));
            }
        }
        if (!methods.isEmpty()) {
            definition.getPropertyValues().addPropertyValue(name, methods);
        }
    }
}
 
Example 6
Source File: ResourcesBeanDefinitionParser.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void parseResourceChain(RootBeanDefinition resourceHandlerDef, ParserContext parserContext,
		Element element, Object source) {

	String autoRegistration = element.getAttribute("auto-registration");
	boolean isAutoRegistration = !(StringUtils.hasText(autoRegistration) && "false".equals(autoRegistration));

	ManagedList<? super Object> resourceResolvers = new ManagedList<Object>();
	resourceResolvers.setSource(source);
	ManagedList<? super Object> resourceTransformers = new ManagedList<Object>();
	resourceTransformers.setSource(source);

	parseResourceCache(resourceResolvers, resourceTransformers, element, source);
	parseResourceResolversTransformers(isAutoRegistration, resourceResolvers, resourceTransformers,
			parserContext, element, source);

	if (!resourceResolvers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceResolvers", resourceResolvers);
	}
	if (!resourceTransformers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceTransformers", resourceTransformers);
	}
}
 
Example 7
Source File: AspectJAutoProxyBeanDefinitionParser.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
	ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node node = childNodes.item(i);
		if (node instanceof Element) {
			Element includeElement = (Element) node;
			TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
			valueHolder.setSource(parserContext.extractSource(includeElement));
			includePatterns.add(valueHolder);
		}
	}
	if (!includePatterns.isEmpty()) {
		includePatterns.setSource(parserContext.extractSource(element));
		beanDef.getPropertyValues().add("includePatterns", includePatterns);
	}
}
 
Example 8
Source File: AspectJAutoProxyBeanDefinitionParser.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
	ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node node = childNodes.item(i);
		if (node instanceof Element) {
			Element includeElement = (Element) node;
			TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
			valueHolder.setSource(parserContext.extractSource(includeElement));
			includePatterns.add(valueHolder);
		}
	}
	if (!includePatterns.isEmpty()) {
		includePatterns.setSource(parserContext.extractSource(element));
		beanDef.getPropertyValues().add("includePatterns", includePatterns);
	}
}
 
Example 9
Source File: ResourcesBeanDefinitionParser.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
private void parseResourceChain(RootBeanDefinition resourceHandlerDef, ParserContext parserContext,
		Element element, Object source) {

	String autoRegistration = element.getAttribute("auto-registration");
	boolean isAutoRegistration = !(StringUtils.hasText(autoRegistration) && "false".equals(autoRegistration));

	ManagedList<? super Object> resourceResolvers = new ManagedList<Object>();
	resourceResolvers.setSource(source);
	ManagedList<? super Object> resourceTransformers = new ManagedList<Object>();
	resourceTransformers.setSource(source);

	parseResourceCache(resourceResolvers, resourceTransformers, element, source);
	parseResourceResolversTransformers(isAutoRegistration, resourceResolvers, resourceTransformers,
			parserContext, element, source);

	if (!resourceResolvers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceResolvers", resourceResolvers);
	}
	if (!resourceTransformers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceTransformers", resourceTransformers);
	}
}