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

es.nitaur.bitbucket.rest.client.http.responseparsers.RestrictedParser Maven / Gradle / Ivy

package es.nitaur.bitbucket.rest.client.http.responseparsers;

import es.nitaur.bitbucket.rest.client.model.Restricted;
import es.nitaur.bitbucket.rest.client.model.RestrictionType;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import java.util.function.Function;

public class RestrictedParser implements Function {

    @Override
    public Restricted apply(JsonElement jsonElement) {
        JsonObject json = jsonElement.getAsJsonObject();
        return new Restricted(
                json.get("id").getAsLong(),
                RestrictionType.valueOf(json.get("type").getAsString()),
                json.get("value").getAsString(),
                Parsers.branchParser().apply(json.getAsJsonObject("branch"))
        );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy