/*
 * Copyright 2016-2019 Stefan Kalscheuer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package de.stklcode.jvault.connector.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Map;

/**
 * Vault Token metamodel.
 *
 * @author Stefan Kalscheuer
 * @since 0.4.0
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public final class Token {
    @JsonProperty("id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String id;

    @JsonProperty("display_name")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String displayName;

    @JsonProperty("no_parent")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean noParent;

    @JsonProperty("no_default_policy")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean noDefaultPolicy;

    @JsonProperty("ttl")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer ttl;

    @JsonProperty("num_uses")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer numUses;

    @JsonProperty("policies")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<String> policies;

    @JsonProperty("meta")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Map<String, String> meta;

    @JsonProperty("renewable")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean renewable;

    /**
     * Construct complete {@link Token} object.
     *
     * @param id              Token ID (optional)
     * @param displayName     Token display name (optional)
     * @param noParent        Token has no parent (optional)
     * @param noDefaultPolicy Do not add default policy (optional)
     * @param ttl             Token TTL in seconds (optional)
     * @param numUses         Number of uses (optional)
     * @param policies        List of policies (optional)
     * @param meta            Metadata (optional)
     * @param renewable       Is the token renewable (optional)
     */
    public Token(final String id,
                 final String displayName,
                 final Boolean noParent,
                 final Boolean noDefaultPolicy,
                 final Integer ttl,
                 final Integer numUses,
                 final List<String> policies,
                 final Map<String, String> meta,
                 final Boolean renewable) {
        this.id = id;
        this.displayName = displayName;
        this.ttl = ttl;
        this.numUses = numUses;
        this.noParent = noParent;
        this.noDefaultPolicy = noDefaultPolicy;
        this.policies = policies;
        this.meta = meta;
        this.renewable = renewable;
    }

    /**
     * @return Token ID
     */
    public String getId() {
        return id;
    }

    /**
     * @return Token display name
     */
    public String getDisplayName() {
        return displayName;
    }

    /**
     * @return Token has no parent
     */
    public Boolean getNoParent() {
        return noParent;
    }

    /**
     * @return Token has no default policy
     */
    public Boolean getNoDefaultPolicy() {
        return noDefaultPolicy;
    }

    /**
     * @return Time-to-live in seconds
     */
    public Integer getTtl() {
        return ttl;
    }

    /**
     * @return Number of uses
     */
    public Integer getNumUses() {
        return numUses;
    }

    /**
     * @return List of policies
     */
    public List<String> getPolicies() {
        return policies;
    }

    /**
     * @return Metadata
     */
    public Map<String, String> getMeta() {
        return meta;
    }

    /**
     * @return Token is renewable
     */
    public Boolean isRenewable() {
        return renewable;
    }
}

@@ -1010,16 +1010,214 @@
 Token %7B%0A
+    /**%0A     * Get %7B@link TokenBuilder%7D instance.%0A     *%0A     * @return Token Builder.%0A     * @since 0.8%0A     */%0A    public static TokenBuilder builder() %7B%0A        return new TokenBuilder();%0A    %7D%0A%0A
     @Jso

Add static builder() method to Token class