Skip to content

JSSD JssdNamedValueProvider

AndreasWBartels edited this page Nov 22, 2016 · 2 revisions

Adding "Iterable getNames()" and "Object getValue(final String name)" to dynamic data types.

Definition

net/anwiba/generated/test/bean/entity.jssd

@JssdUnknownMember
@JssdNamedValueProvider
{
}

result

package net.anwiba.generated.test.bean;

import java.util.LinkedHashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import net.anwiba.commons.ensure.Conditions;
import net.anwiba.commons.ensure.Ensure;
import net.anwiba.commons.utilities.provider.INamedValueProvider;

public class Entity
    implements INamedValueProvider<Object, RuntimeException>
{

    private final Map<String, Object> _unknownMembers = new LinkedHashMap<String, Object>();

    :

    @JsonIgnore
    @Override
    public Iterable<String> getNames() {
        return this._unknownMembers.keySet();
    }

    @Override
    public Object getValue(final String name) {
        if (name == null) {
            return null;
        }
        return this._unknownMembers.get(name);
    }
}

see JssdNamedValueProvider

Clone this wiki locally