Package org.elasticsearch.common.inject

Examples of org.elasticsearch.common.inject.ConfigurationException


     * @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


        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

            // Disallow private constructors on non-private classes (unless they have @Inject)
            if (Modifier.isPrivate(noArgConstructor.getModifiers())
                    && !Modifier.isPrivate(rawType.getModifiers())) {
                errors.missingConstructor(rawType);
                throw new ConfigurationException(errors.getMessages());
            }

            checkForMisplacedBindingAnnotations(noArgConstructor, errors);
            return new InjectionPoint(type, noArgConstructor);
        } catch (NoSuchMethodException e) {
            errors.missingConstructor(rawType);
            throw new ConfigurationException(errors.getMessages());
        }
    }
View Full Code Here

        addInjectionPoints(type, Factory.FIELDS, true, sink, errors);
        addInjectionPoints(type, Factory.METHODS, true, sink, errors);

        ImmutableSet<InjectionPoint> result = ImmutableSet.copyOf(sink);
        if (errors.hasErrors()) {
            throw new ConfigurationException(errors.getMessages()).withPartialValue(result);
        }
        return result;
    }
View Full Code Here

        addInjectionPoints(type, Factory.FIELDS, false, sink, errors);
        addInjectionPoints(type, Factory.METHODS, false, sink, errors);

        ImmutableSet<InjectionPoint> result = ImmutableSet.copyOf(sink);
        if (errors.hasErrors()) {
            throw new ConfigurationException(errors.getMessages()).withPartialValue(result);
        }
        return result;
    }
View Full Code Here

    public void throwConfigurationExceptionIfErrorsExist() {
        if (!hasErrors()) {
            return;
        }

        throw new ConfigurationException(getMessages());
    }
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

        if (reference != null) {
            return reference;
        }

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

            // Disallow private constructors on non-private classes (unless they have @Inject)
            if (Modifier.isPrivate(noArgConstructor.getModifiers())
                    && !Modifier.isPrivate(rawType.getModifiers())) {
                errors.missingConstructor(rawType);
                throw new ConfigurationException(errors.getMessages());
            }

            checkForMisplacedBindingAnnotations(noArgConstructor, errors);
            return new InjectionPoint(type, noArgConstructor);
        } catch (NoSuchMethodException e) {
            errors.missingConstructor(rawType);
            throw new ConfigurationException(errors.getMessages());
        }
    }
View Full Code Here

        addInjectionPoints(type, Factory.FIELDS, true, sink, errors);
        addInjectionPoints(type, Factory.METHODS, true, sink, errors);

        ImmutableSet<InjectionPoint> result = ImmutableSet.copyOf(sink);
        if (errors.hasErrors()) {
            throw new ConfigurationException(errors.getMessages()).withPartialValue(result);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.inject.ConfigurationException

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.