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

com.rosetta.metatest.model.util.Observable12DeepPathUtil Maven / Gradle / Ivy

There is a newer version: 11.35.2
Show newest version
package com.rosetta.metatest.model.util;

import com.rosetta.metatest.model.Asset12;
import com.rosetta.metatest.model.Observable12;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset12;
import com.rosetta.model.lib.mapper.MapperS;
import java.math.BigDecimal;

import static com.rosetta.model.lib.expression.ExpressionOperators.*;

public class Observable12DeepPathUtil {
	public BigDecimal chooseAmount(Observable12 observable12) {
		final MapperS asset12 = MapperS.of(observable12).map("getAsset12", _observable12 -> _observable12.getAsset12());
		if (exists(asset12).getOrDefault(false)) {
			return asset12.map("Type coercion", fieldWithMetaAsset12 -> fieldWithMetaAsset12 == null ? null : fieldWithMetaAsset12.getValue()).map("getAmount", _asset12 -> _asset12.getAmount()).get();
		}
		return null;
	}
	
	public FieldWithMetaAsset12 chooseAsset12(Observable12 observable12) {
		final MapperS asset12 = MapperS.of(observable12).map("getAsset12", _observable12 -> _observable12.getAsset12());
		if (exists(asset12).getOrDefault(false)) {
			return asset12.get();
		}
		return null;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy