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

com.regnosys.rosetta.translate.datamodel.json.JsonAttribute Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.regnosys.rosetta.translate.datamodel.json;

import java.util.HashSet;
import java.util.Set;

import com.regnosys.rosetta.translate.datamodel.Attribute;
import com.regnosys.rosetta.translate.datamodel.Cardinality;
import com.regnosys.rosetta.translate.datamodel.Entity;

public class JsonAttribute implements Attribute {

	private final String name;
	private Entity type;

	public JsonAttribute(String name, Entity type) {
		this.name = name;
		this.type = type;
	}

	@Override
	public Cardinality getCardinality() {
		if (((JsonEntity) type).getType().equals("multi")) {
			return Cardinality.MULTIPLE;
		}
		return Cardinality.SINGLE;
	}

	@Override
	public Entity getType() {
		return type;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return toString(new HashSet<>());
	}

	@Override
	public String toString(Set alreadyWritten) {
		return name + getCardinality().toShortString() + "=" + type.toString(alreadyWritten);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy