All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.englishtown.vertx.zookeeper.ConfigElement Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.englishtown.vertx.zookeeper;

import org.apache.curator.framework.api.CuratorEvent;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

/**
 */
public interface ConfigElement {

    /**
     * Will convert this configuration element into a String.
     * If the original result is null, this method will also return null.
     *
     * @return String
     */
    String asString();

    /**
     * Will attempt to convert this configuration element into an Integer. If conversion isn't possible then an
     * {@link java.lang.IllegalArgumentException} will be thrown.
     *
     * If the original result is null, this method will also return null.
     *
     * @return Integer
     */
    Integer asInteger();

    /**
     * Will attempt to convert this configuration element into a long. If conversion isn't possible then an
     * {@link java.lang.IllegalArgumentException} will be thrown.
     *
     * If the original result is null, this method will also return null.
     *
     * @return long
     */
    Long asLong();

    /**
     * Will attempt to convert this configuration element into an {@link io.vertx.core.json.JsonObject}.
     * If conversion isn't possible then an {@link java.lang.IllegalArgumentException} will be thrown.
     *
     * If the original result is null, this method will also return null.
     *
     * @return JsonObject
     */
    JsonObject asJsonObject();

    /**
     * Will attempt to convert this configuration element into an {@link io.vertx.core.json.JsonArray}.
     * If conversion isn't possible then an {@link java.lang.IllegalArgumentException} will be thrown.
     *
     * If the original result is null, this method will also return null.
     *
     * @return JsonObject
     */
    JsonArray asJsonArray();

    /**
     * Will attempt to convert this configuration element into a boolean. Conversion is not considered possible if the
     * backing byte array has more than 1 byte in it or if that 1 byte is not equal to either 0 or 1.
     *
     * If conversion isn't possible then an {@link java.lang.IllegalArgumentException} will be thrown.
     *
     * If the original result is null, this method will also return null.
     *
     * @return boolean
     */
    Boolean asBoolean();

    /**
     * Will return the configuration element as a byte array. If the original result is null, this method will also
     * return null.
     *
     * @return byte[]
     */
    byte[] asBytes();

    /**
     * Returns true if this element has a value, otherwise false.
     *
     * @return boolean
     */
    boolean hasValue();

    /**
     * Returns the {@link org.apache.curator.framework.api.CuratorEvent} object that provides the raw result of
     * the config element request.
     *
     * @return CuratorEvent
     */
    CuratorEvent getCuratorEvent();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy