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

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

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

import com.rosetta.metatest.model.Asset13;
import com.rosetta.metatest.model.Observable13;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset13;
import com.rosetta.model.lib.mapper.MapperS;
import java.math.BigDecimal;

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

public class Observable13DeepPathUtil {
	public BigDecimal chooseAmount(Observable13 observable13) {
		final MapperS asset13 = MapperS.of(observable13).map("getAsset13", _observable13 -> _observable13.getAsset13());
		if (exists(asset13).getOrDefault(false)) {
			return asset13.map("Type coercion", fieldWithMetaAsset13 -> fieldWithMetaAsset13 == null ? null : fieldWithMetaAsset13.getValue()).map("getAmount", _asset13 -> _asset13.getAmount()).get();
		}
		return null;
	}
	
	public FieldWithMetaAsset13 chooseAsset13(Observable13 observable13) {
		final MapperS asset13 = MapperS.of(observable13).map("getAsset13", _observable13 -> _observable13.getAsset13());
		if (exists(asset13).getOrDefault(false)) {
			return asset13.get();
		}
		return null;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy