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

com.sap.cds.reflect.impl.CdsEventReader Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version
/*******************************************************************
 * © 2020 SAP SE or an SAP affiliate company. All rights reserved. *
 *******************************************************************/
package com.sap.cds.reflect.impl;

import com.fasterxml.jackson.databind.JsonNode;
import com.sap.cds.reflect.impl.reader.model.CdsConstants;

public class CdsEventReader {

	private CdsEventReader() {
	}

	public static CdsEventBuilder read(String qualifiedName, JsonNode csn, CdsModelBuilder model) {
		CdsEventBuilder event = CdsEventBuilder.create(CdsAnnotationReader.read(csn), qualifiedName, getQuery(csn));
		if (csn.has(CdsConstants.TYPE)) {
			event.addDelegationType(csn.get(CdsConstants.TYPE).asText());
			return event;
		}
		event.addElements(CdsStructuredTypeReader.readElementList(qualifiedName, csn, model));
		return event;
	}

	private static String getQuery(JsonNode csn) {
		String query = null;
		if (csn.has(CdsConstants.QUERY)) {
			query = csn.get(CdsConstants.QUERY).toString();
		}
		return query;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy