Package org.fudgemsg

Examples of org.fudgemsg.FudgeField


    if (firstLong != null) {
      final Double secondDouble = msg.getDouble("secondDouble");
      if (secondDouble != null) {
        return LongDoublePair.of(firstLong.longValue(), secondDouble.doubleValue());
      } else {
        final FudgeField secondField = msg.getByName(SECOND_FIELD_NAME);
        final Object second = secondField != null ? deserializer.fieldValueToObject(secondField) : null;
        return LongObjectPair.of(firstLong.longValue(), second);
      }
    }
    final Long firstInt = msg.getLong("firstInt");
    if (firstInt != null) {
      final Double secondDouble = msg.getDouble("secondDouble");
      if (secondDouble != null) {
        return IntDoublePair.of(firstInt.intValue(), secondDouble.doubleValue());
      } else {
        final FudgeField secondField = msg.getByName(SECOND_FIELD_NAME);
        final Object second = secondField != null ? deserializer.fieldValueToObject(secondField) : null;
        return IntObjectPair.of(firstInt.intValue(), second);
      }
    }
    final Double firstDouble = msg.getDouble("firstDouble");
    final Double secondDouble = msg.getDouble("secondDouble");
    if (firstDouble != null && secondDouble != null) {
      return DoublesPair.of(firstDouble.doubleValue(), secondDouble.doubleValue());
    }
    final FudgeField firstField = msg.getByName(FIRST_FIELD_NAME);
    final Object first = firstField != null ? deserializer.fieldValueToObject(firstField) : null;
    final FudgeField secondField = msg.getByName(SECOND_FIELD_NAME);
    final Object second = secondField != null ? deserializer.fieldValueToObject(secondField) : null;
    return ObjectsPair.of(first, second);
  }
View Full Code Here


    }
    return ObjectsPair.of(first, second);
  }

  public static <K, V> ObjectsPair<K, V> buildObject(final FudgeDeserializer deserializer, final FudgeMsg msg, final Class<K> baseK, final Class<V> baseV) {
    FudgeField field = msg.getByName(FIRST_FIELD_NAME);
    final K first = (field != null) ? deserializer.fieldValueToObject(baseK, field) : null;
    field = msg.getByName(SECOND_FIELD_NAME);
    final V second = (field != null) ? deserializer.fieldValueToObject(baseV, field) : null;
    return ObjectsPair.of(first, second);
  }
View Full Code Here

      for (final FudgeField nodeField : nodesFields) {
        final Object obj = deserializer.fieldValueToObject(nodeField);
        nodes.add((CurveNode) obj);
      }
      final CurveDefinition curveDefinition = new CurveDefinition(name, nodes);
      final FudgeField uniqueId = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueId != null) {
        curveDefinition.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueId));
      }
      return curveDefinition;
    }
View Full Code Here

        final String leftExtrapolatorName = message.getString(LEFT_EXTRAPOLATOR_NAME_FIELD);
        curveDefinition = new InterpolatedCurveDefinition(name, nodes, interpolatorName, rightExtrapolatorName, leftExtrapolatorName);
      } else {
        curveDefinition = new InterpolatedCurveDefinition(name, nodes, interpolatorName);
      }
      final FudgeField uniqueId = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueId != null) {
        curveDefinition.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueId));
      }
      return curveDefinition;
    }
View Full Code Here

        final String leftExtrapolatorName = message.getString(LEFT_EXTRAPOLATOR_NAME_FIELD);
        curveDefinition = new FixedDateInterpolatedCurveDefinition(name, nodes, interpolatorName, rightExtrapolatorName, leftExtrapolatorName, fixedDates);
      } else {
        curveDefinition = new FixedDateInterpolatedCurveDefinition(name, nodes, interpolatorName, fixedDates);
      }
      final FudgeField uniqueId = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueId != null) {
        curveDefinition.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueId));
      }
      return curveDefinition;
    }
View Full Code Here

    return message;
  }

  @Override
  public StaticCurveInstrumentProvider buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
    final FudgeField instrumentIdentifier = message.getByName(INSTRUMENT_FIELD);
    final ExternalId identifier = deserializer.fieldValueToObject(ExternalId.class, instrumentIdentifier);
    if (message.hasField(DATA_FIELD) && message.hasField(TYPE_FIELD)) {
      final String dataField = message.getString(DATA_FIELD);
      final DataFieldType fieldType = DataFieldType.valueOf(message.getString(TYPE_FIELD));
      return new StaticCurveInstrumentProvider(identifier, dataField, fieldType);
View Full Code Here

      final boolean isEOM = message.getBoolean(IS_EOM_FIELD);
      final StubType stubType = StubType.valueOf(message.getString(STUB_TYPE_FIELD));
      final boolean exchangeNotional = message.getBoolean(EXCHANGE_NOTIONAL_FIELD);
      final OISLegConvention convention = new OISLegConvention(name, externalIdBundle, overnightIndexConvention, paymentTenor,
          businessDayConvention, settlementDays, isEOM, stubType, exchangeNotional, paymentLag);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
      return convention;
    }
View Full Code Here

      final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount(message.getString(DAY_COUNT_FIELD));
      final int publicationLag = message.getInt(PUBLICATION_LAG_FIELD);
      final Currency currency = Currency.of(message.getString(CURRENCY_FIELD));
      final ExternalId region = deserializer.fieldValueToObject(ExternalId.class, message.getByName(REGION_FIELD));
      final OvernightIndexConvention convention = new OvernightIndexConvention(name, externalIdBundle, dayCount, publicationLag, currency, region);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
      return convention;
    }
View Full Code Here

      final ExternalIdBundle externalIdBundle = deserializer.fieldValueToObject(ExternalIdBundle.class, message.getByName(EXTERNAL_ID_BUNDLE_FIELD));
      final Currency currency = Currency.of(message.getString(CURRENCY_FIELD));
      final ExternalId region = deserializer.fieldValueToObject(ExternalId.class, message.getByName(REGION_FIELD));
      final ExternalId priceIndexId = deserializer.fieldValueToObject(ExternalId.class, message.getByName(PRICE_INDEX_ID_FIELD));
      final PriceIndexConvention convention = new PriceIndexConvention(name, externalIdBundle, currency, region, priceIndexId);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
      return convention;
    }
View Full Code Here

      final String name = message.getString(NAME_FIELD);
      final ExternalIdBundle externalIdBundle = deserializer.fieldValueToObject(ExternalIdBundle.class, message.getByName(EXTERNAL_ID_BUNDLE_FIELD));
      final ExternalId payLegConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(PAY_LEG_FIELD));
      final ExternalId receiveLegConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(RECEIVE_LEG_FIELD));
      final SwapConvention convention = new SwapConvention(name, externalIdBundle, payLegConvention, receiveLegConvention);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
      return convention;
    }
View Full Code Here

TOP

Related Classes of org.fudgemsg.FudgeField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.