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


Java ProvisionException类代码示例

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


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

示例1: invoke

import org.elasticsearch.common.inject.ProvisionException; //导入依赖的package包/类
/**
 * When a factory method is invoked, we create a child injector that binds all parameters, then
 * use that to get an instance of the return type.
 */
@Override
public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
    if (method.getDeclaringClass() == Object.class) {
        return method.invoke(this, args);
    }

    Provider<?> provider = getBindingFromNewInjector(method, args).getProvider();
    try {
        return provider.get();
    } catch (ProvisionException e) {
        // if this is an exception declared by the factory method, throw it as-is
        if (e.getErrorMessages().size() == 1) {
            Message onlyError = Iterables.getOnlyElement(e.getErrorMessages());
            Throwable cause = onlyError.getCause();
            if (cause != null && canRethrow(method, cause)) {
                throw cause;
            }
        }
        throw e;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:26,代码来源:FactoryProvider2.java

示例2: getMessagesFromThrowable

import org.elasticsearch.common.inject.ProvisionException; //导入依赖的package包/类
public static Collection<Message> getMessagesFromThrowable(Throwable throwable) {
    if (throwable instanceof ProvisionException) {
        return ((ProvisionException) throwable).getErrorMessages();
    } else if (throwable instanceof ConfigurationException) {
        return ((ConfigurationException) throwable).getErrorMessages();
    } else if (throwable instanceof CreationException) {
        return ((CreationException) throwable).getErrorMessages();
    } else {
        return emptySet();
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:Errors.java

示例3: throwProvisionExceptionIfErrorsExist

import org.elasticsearch.common.inject.ProvisionException; //导入依赖的package包/类
public void throwProvisionExceptionIfErrorsExist() {
    if (!hasErrors()) {
        return;
    }

    throw new ProvisionException(getMessages());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:Errors.java

示例4: getMessagesFromThrowable

import org.elasticsearch.common.inject.ProvisionException; //导入依赖的package包/类
public static Collection<Message> getMessagesFromThrowable(Throwable throwable) {
    if (throwable instanceof ProvisionException) {
        return ((ProvisionException) throwable).getErrorMessages();
    } else if (throwable instanceof ConfigurationException) {
        return ((ConfigurationException) throwable).getErrorMessages();
    } else if (throwable instanceof CreationException) {
        return ((CreationException) throwable).getErrorMessages();
    } else {
        return ImmutableSet.of();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:Errors.java

示例5: testThatBrokenRegexLeadsToException

import org.elasticsearch.common.inject.ProvisionException; //导入依赖的package包/类
@Test(expected = ProvisionException.class)
public void testThatBrokenRegexLeadsToException() throws Exception {
    String excludeRegex = "*.peakCount";
    createNode(clusterName, GRAPHITE_SERVER_PORT, "1s", null, excludeRegex, null);
}
 
开发者ID:spinscale,项目名称:elasticsearch-graphite-plugin,代码行数:6,代码来源:GraphitePluginIntegrationTest.java


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