createNonNativeAsset static method
Creates one of AssetTypeCreditAlphaNum4 or AssetTypeCreditAlphaNum12 object based on a code
, its length and the issuer
of the asset.
Implementation
static Asset createNonNativeAsset(String code, String issuer) {
if (code.length >= 1 && code.length <= 4) {
return new AssetTypeCreditAlphaNum4(code, issuer);
} else if (code.length >= 5 && code.length <= 12) {
return new AssetTypeCreditAlphaNum12(code, issuer);
} else {
throw new AssetCodeLengthInvalidException();
}
}