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

com.github.pgelinas.jackson.javax.json.JacksonEntry Maven / Gradle / Ivy

Go to download

An alternate implementation of JSR-353 based on Jackson, which aims to bring better performance and configurability.

The newest version!
package com.github.pgelinas.jackson.javax.json;

import java.util.*;
import java.util.Map.Entry;

import javax.json.*;

import com.fasterxml.jackson.databind.*;

public final class JacksonEntry implements Entry {
    private final Entry _entry;
    private final NodeFactory _nodeFactory;

    public JacksonEntry(Map.Entry entry, NodeFactory nodeFactory) {
        _entry = entry;
        _nodeFactory = nodeFactory;
    }

    @Override
    public String getKey() {
        return _entry.getKey();
    }

    @Override
    public JsonValue getValue() {
        return _nodeFactory.from(_entry.getValue());
    }

    @Override
    public JsonValue setValue(JsonValue value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((_entry == null) ? 0 : _entry.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        JacksonEntry other = (JacksonEntry) obj;
        if (_entry == null) {
            if (other._entry != null) return false;
        } else if (!_entry.equals(other._entry)) return false;
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy