// Path: src/main/java/com/ccreanga/bitbucket/rest/client/model/Comment.java
// public class Comment implements Serializable {
// 
//     private long id;
//     private long version;
//     private String text;
//     private User author;
//     private Date created;
//     private Date updated;
//     private List<Comment> comments;
//     private PermittedOperations permittedOperations;
// 
//     private Comment() {
//     }
// 
//     public Comment(long id, long version, String text, User author, Date created, Date updated, List<Comment> comments, PermittedOperations permittedOperations) {
//         this.id = id;
//         this.version = version;
//         this.text = text;
//         this.author = author;
//         this.created = created;
//         this.updated = updated;
//         this.comments = ImmutableList.copyOf(comments);
//         this.permittedOperations = permittedOperations;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public long getVersion() {
//         return version;
//     }
// 
//     public String getText() {
//         return text;
//     }
// 
//     public User getAuthor() {
//         return author;
//     }
// 
//     public Date getCreated() {
//         return created;
//     }
// 
//     public Date getUpdated() {
//         return updated;
//     }
// 
//     public List<Comment> getComments() {
//         return comments;
//     }
// 
//     public PermittedOperations getPermittedOperations() {
//         return permittedOperations;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
//         Comment comment = (Comment) o;
//         return Objects.equals(id, comment.id) &&
//                 Objects.equals(version, comment.version) &&
//                 Objects.equals(text, comment.text) &&
//                 Objects.equals(author, comment.author) &&
//                 Objects.equals(created, comment.created) &&
//                 Objects.equals(updated, comment.updated) &&
//                 Objects.equals(comments, comment.comments) &&
//                 Objects.equals(permittedOperations, comment.permittedOperations);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id, version, text, author, created, updated, comments, permittedOperations);
//     }
// 
//     @Override
//     public String toString() {
//         return "Comment{" +
//                 "id=" + id +
//                 ", version=" + version +
//                 ", text='" + text + '\'' +
//                 ", author=" + author +
//                 ", created=" + created +
//                 ", updated=" + updated +
//                 ", comments=" + comments +
//                 ", permittedOperations=" + permittedOperations +
//                 '}';
//     }
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement, Comment> commentParser() {
//     return COMMENT_PARSER;
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static <T> Function<JsonElement, List<T>> listParser(Function<JsonElement, T> elementParser) {
//     return new ListParser<>(elementParser);
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement,PermittedOperations> permittedOperationsParser(){return  PERMITTED_OPERATIONS_PARSER;}
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement, User> userParser() {
//     return USER_PARSER;
// }


import com.ccreanga.bitbucket.rest.client.model.Comment;
import java.util.function.Function;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.Date;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.commentParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.listParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.permittedOperationsParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.userParser;
/*
 *
 *  *
 *  * 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 com.ccreanga.bitbucket.rest.client.http.responseparsers;




public class CommentParser  implements Function<JsonElement, Comment> {
    @Override
    public Comment apply(JsonElement jsonElement) {
        if (jsonElement == null || !jsonElement.isJsonObject()) {
            return null;
        }
        JsonObject json = jsonElement.getAsJsonObject();
        return new Comment(
                json.get("id").getAsLong(),
                json.get("version").getAsLong(),
                json.get("text").getAsString(),
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/model/Comment.java
// public class Comment implements Serializable {
// 
//     private long id;
//     private long version;
//     private String text;
//     private User author;
//     private Date created;
//     private Date updated;
//     private List<Comment> comments;
//     private PermittedOperations permittedOperations;
// 
//     private Comment() {
//     }
// 
//     public Comment(long id, long version, String text, User author, Date created, Date updated, List<Comment> comments, PermittedOperations permittedOperations) {
//         this.id = id;
//         this.version = version;
//         this.text = text;
//         this.author = author;
//         this.created = created;
//         this.updated = updated;
//         this.comments = ImmutableList.copyOf(comments);
//         this.permittedOperations = permittedOperations;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public long getVersion() {
//         return version;
//     }
// 
//     public String getText() {
//         return text;
//     }
// 
//     public User getAuthor() {
//         return author;
//     }
// 
//     public Date getCreated() {
//         return created;
//     }
// 
//     public Date getUpdated() {
//         return updated;
//     }
// 
//     public List<Comment> getComments() {
//         return comments;
//     }
// 
//     public PermittedOperations getPermittedOperations() {
//         return permittedOperations;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
//         Comment comment = (Comment) o;
//         return Objects.equals(id, comment.id) &&
//                 Objects.equals(version, comment.version) &&
//                 Objects.equals(text, comment.text) &&
//                 Objects.equals(author, comment.author) &&
//                 Objects.equals(created, comment.created) &&
//                 Objects.equals(updated, comment.updated) &&
//                 Objects.equals(comments, comment.comments) &&
//                 Objects.equals(permittedOperations, comment.permittedOperations);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id, version, text, author, created, updated, comments, permittedOperations);
//     }
// 
//     @Override
//     public String toString() {
//         return "Comment{" +
//                 "id=" + id +
//                 ", version=" + version +
//                 ", text='" + text + '\'' +
//                 ", author=" + author +
//                 ", created=" + created +
//                 ", updated=" + updated +
//                 ", comments=" + comments +
//                 ", permittedOperations=" + permittedOperations +
//                 '}';
//     }
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement, Comment> commentParser() {
//     return COMMENT_PARSER;
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static <T> Function<JsonElement, List<T>> listParser(Function<JsonElement, T> elementParser) {
//     return new ListParser<>(elementParser);
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement,PermittedOperations> permittedOperationsParser(){return  PERMITTED_OPERATIONS_PARSER;}
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement, User> userParser() {
//     return USER_PARSER;
// }


// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/CommentParser.java
import com.ccreanga.bitbucket.rest.client.model.Comment;
import java.util.function.Function;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.Date;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.commentParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.listParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.permittedOperationsParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.userParser;

/*
 *
 *  *
 *  * 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 com.ccreanga.bitbucket.rest.client.http.responseparsers;




public class CommentParser  implements Function<JsonElement, Comment> {
    @Override
    public Comment apply(JsonElement jsonElement) {
        if (jsonElement == null || !jsonElement.isJsonObject()) {
            return null;
        }
        JsonObject json = jsonElement.getAsJsonObject();
        return new Comment(
                json.get("id").getAsLong(),
                json.get("version").getAsLong(),
                json.get("text").getAsString(),
                userParser().apply(json.getAsJsonObject("author")),