当前位置: 首页>>代码示例>>Java>>正文


Java Location类代码示例

本文整理汇总了Java中org.springframework.beans.factory.parsing.Location的典型用法代码示例。如果您正苦于以下问题:Java Location类的具体用法?Java Location怎么用?Java Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Location类属于org.springframework.beans.factory.parsing包,在下文中一共展示了Location类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: xmlns

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
/**
 * Define a Spring namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler = this.xmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:GroovyBeanDefinitionReader.java

示例2: xmlns

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
/**
 * Define a Spring XML namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler = this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(
				uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:GroovyBeanDefinitionReader.java

示例3: xmlns

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
/**
 * Define a Spring XML namespace definition to use.
 * @param definition the namespace definition
 */
public void xmlns(Map<String, String> definition) {
	if (!definition.isEmpty()) {
		for (Map.Entry<String,String> entry : definition.entrySet()) {
			String namespace = entry.getKey();
			String uri = entry.getValue();
			if (uri == null) {
				throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
			}
			NamespaceHandler namespaceHandler =
					this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
			if (namespaceHandler == null) {
				throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
						new Location(new DescriptiveResource(("Groovy")))));
			}
			this.namespaces.put(namespace, uri);
		}
	}
}
 
开发者ID:txazo,项目名称:spring,代码行数:23,代码来源:GroovyBeanDefinitionReader.java

示例4: parseInternal

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
/**
 * @param element
 * @param parserContext
 * @return
 * @see org.springframework.beans.factory.xml.AbstractBeanDefinitionParser#parseInternal(org.w3c.dom.Element,
 *      org.springframework.beans.factory.xml.ParserContext)
 */
@Override
protected AbstractBeanDefinition parseInternal(final Element element,
		final ParserContext parserContext)
{
	final BeanDefinitionBuilder factory = parsePFixture(element);

	final List<Element> childElements = DomUtils.getChildElementsByTagName(element,
			CoreSchemaConstants.ELEMENT_LOCATION);
	// Must have at least one element
	if (childElements == null || childElements.isEmpty())
	{
		throw new BeanDefinitionParsingException(
				new Problem(
						"Portable test fixture manager must be wired with at least one context location",
						new Location(parserContext.getReaderContext().getResource())));
	}
	parseChildLocations(childElements, factory);

	return factory.getBeanDefinition();
}
 
开发者ID:openfurther,项目名称:further-open-core,代码行数:28,代码来源:PFixtureManagerBeanDefinitionParser.java

示例5: CircularImportProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public CircularImportProblem(ConfigurationClass attemptedImport, Stack<ConfigurationClass> importStack, AnnotationMetadata metadata) {
	super(String.format("A circular @Import has been detected: " +
			"Illegal attempt by @Configuration class '%s' to import class '%s' as '%s' is " +
			"already present in the current import stack [%s]", importStack.peek().getSimpleName(),
			attemptedImport.getSimpleName(), attemptedImport.getSimpleName(), importStack),
			new Location(importStack.peek().getResource(), metadata));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ConfigurationClassParser.java

示例6: loadBeanDefinitions

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
/**
 * Load bean definitions from the specified Groovy script.
 * @param encodedResource the resource descriptor for the Groovy script,
 * allowing to specify an encoding to use for parsing the file
 * @return the number of bean definitions found
 * @throws BeanDefinitionStoreException in case of loading or parsing errors
 */
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
	Closure beans = new Closure(this){
		public Object call(Object[] args) {
			invokeBeanDefiningClosure((Closure) args[0]);
			return null;
		}
	};
	Binding binding = new Binding() {
		@Override
		public void setVariable(String name, Object value) {
			if (currentBeanDefinition !=null) {
				applyPropertyToBeanDefinition(name, value);
			}
			else {
				super.setVariable(name, value);
			}
		}
	};
	binding.setVariable("beans", beans);

	int countBefore = getRegistry().getBeanDefinitionCount();
	try {
		GroovyShell shell = new GroovyShell(getResourceLoader().getClassLoader(), binding);
		shell.evaluate(encodedResource.getReader(), encodedResource.getResource().getFilename());
	}
	catch (Throwable ex) {
		throw new BeanDefinitionParsingException(new Problem("Error evaluating Groovy script: " + ex.getMessage(),
				new Location(encodedResource.getResource()), null, ex));
	}
	return getRegistry().getBeanDefinitionCount() - countBefore;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:GroovyBeanDefinitionReader.java

示例7: CircularImportProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public CircularImportProblem(ConfigurationClass attemptedImport, Stack<ConfigurationClass> importStack) {
	super(String.format("A circular @Import has been detected: " +
			"Illegal attempt by @Configuration class '%s' to import class '%s' as '%s' is " +
			"already present in the current import stack %s", importStack.peek().getSimpleName(),
			attemptedImport.getSimpleName(), attemptedImport.getSimpleName(), importStack),
			new Location(importStack.peek().getResource(), attemptedImport.getMetadata()));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:ConfigurationClassParser.java

示例8: loadBeanDefinitions

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
/**
 * Load bean definitions from the specified Groovy script or XML file.
 * <p>Note that {@code ".xml"} files will be parsed as XML content; all other kinds
 * of resources will be parsed as Groovy scripts.
 * @param encodedResource the resource descriptor for the Groovy script or XML file,
 * allowing specification of an encoding to use for parsing the file
 * @return the number of bean definitions found
 * @throws BeanDefinitionStoreException in case of loading or parsing errors
 */
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
	// Check for XML files and redirect them to the "standard" XmlBeanDefinitionReader
	String filename = encodedResource.getResource().getFilename();
	if (StringUtils.endsWithIgnoreCase(filename, ".xml")) {
		return this.standardXmlBeanDefinitionReader.loadBeanDefinitions(encodedResource);
	}

	Closure beans = new Closure(this) {
		public Object call(Object[] args) {
			invokeBeanDefiningClosure((Closure) args[0]);
			return null;
		}
	};
	Binding binding = new Binding() {
		@Override
		public void setVariable(String name, Object value) {
			if (currentBeanDefinition != null) {
				applyPropertyToBeanDefinition(name, value);
			}
			else {
				super.setVariable(name, value);
			}
		}
	};
	binding.setVariable("beans", beans);

	int countBefore = getRegistry().getBeanDefinitionCount();
	try {
		GroovyShell shell = new GroovyShell(getResourceLoader().getClassLoader(), binding);
		shell.evaluate(encodedResource.getReader(), "beans");
	}
	catch (Throwable ex) {
		throw new BeanDefinitionParsingException(new Problem("Error evaluating Groovy script: " + ex.getMessage(),
				new Location(encodedResource.getResource()), null, ex));
	}
	return getRegistry().getBeanDefinitionCount() - countBefore;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:47,代码来源:GroovyBeanDefinitionReader.java

示例9: CircularImportProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public CircularImportProblem(ConfigurationClass attemptedImport, Deque<ConfigurationClass> importStack) {
	super(String.format("A circular @Import has been detected: " +
			"Illegal attempt by @Configuration class '%s' to import class '%s' as '%s' is " +
			"already present in the current import stack %s", importStack.peek().getSimpleName(),
			attemptedImport.getSimpleName(), attemptedImport.getSimpleName(), importStack),
			new Location(importStack.peek().getResource(), attemptedImport.getMetadata()));
}
 
开发者ID:txazo,项目名称:spring,代码行数:8,代码来源:ConfigurationClassParser.java

示例10: getResourceLocation

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public Location getResourceLocation() {
	return new Location(this.configurationClass.getResource(), this.metadata);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:ConfigurationMethod.java

示例11: InvalidConfigurationImportProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public InvalidConfigurationImportProblem(String className, Resource resource, AnnotationMetadata metadata) {
	super(String.format("%s was @Import'ed but is not annotated with @Configuration " +
			"nor does it declare any @Bean methods; it does not implement ImportSelector " +
			"or extend ImportBeanDefinitionRegistrar. Update the class to meet one of these requirements " +
			"or do not attempt to @Import it.", className), new Location(resource, metadata));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:ConfigurationClassBeanDefinitionReader.java

示例12: FinalConfigurationProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public FinalConfigurationProblem() {
	super(String.format("@Configuration class '%s' may not be final. Remove the final modifier to continue.",
			getSimpleName()), new Location(getResource(), getMetadata()));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ConfigurationClass.java

示例13: BeanMethodOverloadingProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public BeanMethodOverloadingProblem(String methodName, int count) {
	super(String.format("@Configuration class '%s' has %s overloaded @Bean methods named '%s'. " +
			"Only one @Bean method of a given name is allowed within each @Configuration class.",
			getSimpleName(), count, methodName), new Location(getResource(), getMetadata()));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:6,代码来源:ConfigurationClass.java

示例14: InvalidConfigurationImportProblem

import org.springframework.beans.factory.parsing.Location; //导入依赖的package包/类
public InvalidConfigurationImportProblem(final String className, final Resource resource, final AnnotationMetadata metadata) {
  super(String.format("%s was @Import'ed but is not annotated with @Configuration "
      + "nor does it declare any @Bean methods; it does not implement ImportSelector "
      + "or extend ImportBeanDefinitionRegistrar. Update the class to meet one of these requirements "
      + "or do not attempt to @Import it.", className), new Location(resource, metadata));
}
 
开发者ID:ahoehma,项目名称:spring-autowire-qualified-beans,代码行数:7,代码来源:ConfigurationClassBeanDefinitionReader.java


注:本文中的org.springframework.beans.factory.parsing.Location类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。