Package com.addthis.codec.plugins

Examples of com.addthis.codec.plugins.PluginMap.baseClass()


        if (pluginMap == null) {
            throw new ConfigException.BadValue(config.root().get(category).origin(),
                                               category,
                                               "top level key must be a valid category");
        }
        Class<?> baseClass = Objects.firstNonNull(pluginMap.baseClass(), Object.class);
        return expandSugar(baseClass, config.root().get(category), pluginRegistry);
    }

    public static ConfigValue expandSugar(Class<?> type, ConfigValue config,
                                          PluginRegistry pluginRegistry) {
View Full Code Here


    public <T> T decodeObject(@Nonnull String category, @Syntax("HOCON") String configText)
            throws JsonProcessingException, IOException {
        PluginMap pluginMap = Preconditions.checkNotNull(pluginRegistry.asMap().get(category),
                                                         "could not find anything about the category %s", category);
        Config config = ConfigFactory.parseString(configText).resolve();
        return (T) decodeObject(pluginMap.baseClass(), config);
    }

    /**
     * Tries to parse the string as an isolated typesafe-config object, tries to resolve it, and then calls
     * {@link #decodeObject(Class, Config)} with the resultant config and the passed in type. Pretty much just
View Full Code Here

     */
    public <T> T decodeObject(@Nonnull String category, @Nonnull Config config)
            throws JsonProcessingException, IOException {
        PluginMap pluginMap = Preconditions.checkNotNull(pluginRegistry.asMap().get(category),
                                                         "could not find anything about the category %s", category);
        return (T) decodeObject(pluginMap.baseClass(), config);
    }

    /**
     * Instantiate an object of the requested type based on the provided config. The config should only contain
     * field and type information for the object to be constructed. Global defaults, plugin configuration, etc, are
View Full Code Here

            throw new ConfigException.BadValue(config.root().get(category).origin(),
                                               category,
                                               "top level key must be a valid category");
        }
        ConfigValue configValue = config.root().get(category);
        return (T) decodeObject(pluginMap.baseClass(), configValue);
    }

    public <T> T validate(T value) {
        Set<ConstraintViolation<T>> violations = validator.validate(value);
        if (!violations.isEmpty()) {
View Full Code Here

        if (pluginMap == null) {
            throw new ConfigException.BadValue(config.root().get(category).origin(),
                                               category,
                                               "top level key must be a valid category");
        }
        Class<?> baseClass = Objects.firstNonNull(pluginMap.baseClass(), Object.class);
        return expandSugar(baseClass, config.root().get(category), codec);
    }

    public static ConfigValue expandSugar(Class<?> type, ConfigValue config, CodecConfig codec) {
        CodableClassInfo typeInfo = codec.getOrCreateClassInfo(type);
View Full Code Here

        if (pluginMap == null) {
            throw new ConfigException.BadValue(config.root().get(category).origin(),
                                               category,
                                               "top level key must be a valid category");
        }
        Class<?> baseClass = Objects.firstNonNull(pluginMap.baseClass(), Object.class);
        return expandSugar(baseClass, config.root().get(category), codec);
    }

    public static ConfigValue expandSugar(Class<?> type, ConfigValue config, CodecConfig codec) {
        if ((type != null) && type.isAssignableFrom(ConfigValue.class)) {
View Full Code Here

    public <T> T decodeObject(@Nonnull String category, @Syntax("HOCON") String configText)
            throws JsonProcessingException, IOException {
        PluginMap pluginMap = Preconditions.checkNotNull(pluginRegistry.asMap().get(category),
                                                         "could not find anything about the category %s", category);
        Config config = ConfigFactory.parseString(configText).resolve();
        return (T) decodeObject(pluginMap.baseClass(), config);
    }

    public <T> T decodeObject(@Nonnull Class<T> type, @Syntax("HOCON") String configText)
            throws JsonProcessingException, IOException {
        Config config = ConfigFactory.parseString(configText).resolve();
View Full Code Here

    public <T> T decodeObject(@Nonnull String category, @Nonnull Config config)
            throws JsonProcessingException, IOException {
        PluginMap pluginMap = Preconditions.checkNotNull(pluginRegistry.asMap().get(category),
                                                         "could not find anything about the category %s", category);
        return (T) decodeObject(pluginMap.baseClass(), config);
    }

    public <T> T decodeObject(@Nonnull Class<T> type, Config config)
            throws JsonProcessingException, IOException {
        return decodeObject(type, config.root());
View Full Code Here

            throw new ConfigException.BadValue(config.root().get(category).origin(),
                                               category,
                                               "top level key must be a valid category");
        }
        ConfigValue configValue = config.root().get(category);
        return (T) decodeObject(pluginMap.baseClass(), configValue);
    }

    public <T> T validate(T value) {
        Set<ConstraintViolation<T>> violations = validator.validate(value);
        if (!violations.isEmpty()) {
View Full Code Here

        if (pluginMap == null) {
            throw new ConfigException.BadValue(config.root().get(category).origin(),
                                               category,
                                               "top level key must be a valid category");
        }
        Class<?> baseClass = Objects.firstNonNull(pluginMap.baseClass(), Object.class);
        return expandSugar(baseClass, config.root().get(category), codec);
    }

    public static ConfigObject expandSugar(Class<?> type, ConfigValue config, CodecConfig codec) {
        CodableClassInfo typeInfo = codec.getOrCreateClassInfo(type);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.