本文整理了Java中com.google.inject.spi.Element.getSource()
方法的一些代码示例,展示了Element.getSource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getSource()
方法的具体详情如下:
包路径:com.google.inject.spi.Element
类名称:Element
方法名:getSource
[英]Returns an arbitrary object containing information about the "place" where this element was configured. Used by Guice in the production of descriptive error messages.
Tools might specially handle types they know about; StackTraceElement is a good example. Tools should simply call toString() on the source object if the type is unfamiliar.
[中]返回任意对象,其中包含有关配置此元素的“位置”的信息。Guice在生成描述性错误消息时使用。
工具可能专门处理他们知道的类型;StackTraceeElement就是一个很好的例子。如果源对象的类型不熟悉,那么工具应该只调用源对象上的toString()。
代码示例来源:origin: com.google.inject/guice
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: io.github.gwtplus.gin/gin
/**
* Create a {@code Context} storing the context of the given Guice
* {@link Element}.
*/
public static Context forElement(Element element) {
return new Context("%s", element.getSource());
}
代码示例来源:origin: com.netflix.governator/governator-core
/**
* @param elements List of elements
* @return List all Module classes that were involved in setting up bindings for the list of Elements
*/
public static List<String> getAllSourceModules(List<Element> elements) {
List<String> names = new ArrayList<>();
for (Element element : elements) {
if (element.getSource().getClass().isAssignableFrom(ElementSource.class)) {
ElementSource source = (ElementSource)element.getSource();
names.addAll(source.getModuleClassNames());
}
}
return names;
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: com.jwebmp.inject/guice
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: com.google/inject
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: Nextdoor/bender
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: org.xbib/guice
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: com.netflix.governator/governator-core
@Override
protected String visitOther(Element element) {
Object source = element.getSource();
ElementSource elementSource = null;
while (source instanceof ElementSource) {
elementSource = (ElementSource)source;
source = elementSource.getOriginalElementSource();
}
if (elementSource != null) {
return elementSource.getModuleClassNames().toString();
}
return null;
}
}
代码示例来源:origin: io.github.gwtplus.gin/gin
protected Void visitOther(Element element) {
visit(new Message(element.getSource(), "Ignoring unsupported Module element: " + element));
return null;
}
代码示例来源:origin: org.atteo.moonshine/container
private <T> void bindKey(Key<T> key) {
Key<T> sourceKey;
Class<? extends Annotation> annotation = dependency.getAnnotation();
if (annotation == ImportService.NoAnnotation.class) {
sourceKey = Key.get(key.getTypeLiteral());
} else {
sourceKey = Key.get(key.getTypeLiteral(), annotation);
}
if (!sourceKey.equals(key)) {
binder.withSource(element.getSource()).bind(sourceKey).to(key);
}
}
内容来源于网络,如有侵权,请联系作者删除!