Package org.elasticsearch.common.inject.spi

Examples of org.elasticsearch.common.inject.spi.Message


        initCause(Errors.getOnlyCause(this.messages));
    }

    public ProvisionException(String message, Throwable cause) {
        super(cause);
        this.messages = ImmutableSet.of(new Message(ImmutableList.of(), message, cause));
    }
View Full Code Here


        super(cause);
        this.messages = ImmutableSet.of(new Message(ImmutableList.of(), message, cause));
    }

    public ProvisionException(String message) {
        this.messages = ImmutableSet.of(new Message(message));
    }
View Full Code Here

     * all factory methods will be able to build the target types.
     */
    @Inject
    void initialize(Injector injector) {
        if (this.injector != null) {
            throw new ConfigurationException(ImmutableList.of(new Message(FactoryProvider2.class,
                    "Factories.create() factories may only be used in one Injector!")));
        }

        this.injector = injector;

View Full Code Here

        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;
View Full Code Here

        return factoryRawType.cast(Proxy.newProxyInstance(factoryRawType.getClassLoader(),
                new Class[]{factoryRawType}, invocationHandler));
    }

    private static ConfigurationException newConfigurationException(String format, Object... args) {
        return new ConfigurationException(ImmutableSet.of(new Message(Errors.format(format, args))));
    }
View Full Code Here

    static void checkConfiguration(boolean condition, String format, Object... args) {
        if (condition) {
            return;
        }

        throw new ConfigurationException(ImmutableSet.of(new Message(Errors.format(format, args))));
    }
View Full Code Here

            return reference;
        }

        NullPointerException npe = new NullPointerException(name);
        throw new ConfigurationException(ImmutableSet.of(
                new Message(ImmutableList.of(), npe.toString(), npe)));
    }
View Full Code Here

     * @throws ConfigurationException if {@code type} contains a type variable
     */
    public static <T> TypeLiteral<T> makeKeySafe(TypeLiteral<T> type) {
        if (!isFullySpecified(type.getType())) {
            String message = type + " cannot be used as a key; It is not fully specified.";
            throw new ConfigurationException(ImmutableSet.of(new Message(message)));
        }

        @SuppressWarnings("unchecked")
        TypeLiteral<T> wrappedPrimitives = (TypeLiteral<T>) PRIMITIVE_TO_WRAPPER.get(type);
        return wrappedPrimitives != null
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.inject.spi.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.