Package org.fudgemsg

Examples of org.fudgemsg.FudgeField


    final Iterator<FudgeField> itrType = (typeMsg != null) ? typeMsg.iterator() : null;
    int i = 0;
    while (itrValue.hasNext()) {
      Class<?> type = null;
      if (itrType != null) {
        final FudgeField typeField = itrType.next();
        final Object val = typeField.getValue();
        if (val instanceof String) {
          try {
            type = ClassUtils.loadClass((String) val);
          } catch (ClassNotFoundException e) {
            s_logger.warn("Message field {} requires unknown class {}", i, val);
View Full Code Here


    }
    return keys;
  }

  protected Double[] readDoubleKeys(final FudgeMsg message, final String keysKey) {
    final FudgeField field = message.getByName(keysKey);
    if (field == null) {
      s_logger.warn("Message field {} not found in {}", keysKey, message);
      throw new IllegalArgumentException("Message is not a LabelledMatrix3D - does not contain a " + keysKey + " field");
    }
    final double[] keys = message.getFieldValue(double[].class, field);
View Full Code Here

   * @param y number of values in the Y dimension
   * @param z number of values in the Z dimension
   * @return the values
   */
  protected double[][][] readValues(final FudgeMsg message, final int x, final int y, final int z) {
    final FudgeField field = message.getByName(VALUES_KEY);
    if (field == null) {
      s_logger.warn("Message field {} not found in {}", VALUES_KEY, message);
      throw new IllegalArgumentException("Message is not a LabelledMatrix3D - does not contain a " + VALUES_KEY + " field");
    }
    final double[] flat = message.getFieldValue(double[].class, field);
View Full Code Here

  }

  @Override
  public VolatilityCubeData buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
    final Class<?> mapClass = Map.class;
    final FudgeField pointsField = message.getByName(DATA_POINTS_FIELD_NAME);
    final FudgeField idsField = message.getByName(DATA_IDS_FIELD_NAME);
    final FudgeField relativeStrikesField = message.getByName(DATA_RELATIVE_STRIKES_FIELD_NAME);

    @SuppressWarnings("unchecked")
    final Map<VolatilityPoint, Double> dataPoints = (Map<VolatilityPoint, Double>) (pointsField == null ? null : deserializer.fieldValueToObject(mapClass, pointsField));
    @SuppressWarnings("unchecked")
    final Map<VolatilityPoint, ExternalIdBundle> dataIds = (Map<VolatilityPoint, ExternalIdBundle>) (idsField == null ? null : deserializer.fieldValueToObject(mapClass, idsField));
    @SuppressWarnings("unchecked")
    final Map<VolatilityPoint, Double> relativeStrikes = (Map<VolatilityPoint, Double>) (relativeStrikesField == null ? null : deserializer.fieldValueToObject(mapClass, relativeStrikesField));

    final FudgeField otherField = message.getByName(OTHER_DATA_FIELD_NAME);
    final SnapshotDataBundle otherData = otherField == null ? null : deserializer.fieldValueToObject(SnapshotDataBundle.class, otherField);

    final VolatilityCubeData ret = new VolatilityCubeData();
    ret.setDataPoints(dataPoints);
    ret.setDataIds(dataIds);
View Full Code Here

    return portfolio.getAttributes() != null && !portfolio.getAttributes().isEmpty();
  }

  @Override
  public Portfolio buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    FudgeField idField = message.getByName(IDENTIFIER_FIELD_NAME);
    final UniqueId id = idField != null ? deserializer.fieldValueToObject(UniqueId.class, idField) : null;
    final String name = message.getFieldValue(String.class, message.getByName(NAME_FIELD_NAME));
    final PortfolioNode node = deserializer.fieldValueToObject(PortfolioNode.class, message.getByName(ROOT_FIELD_NAME));
   
    SimplePortfolio portfolio = new SimplePortfolio(name);
View Full Code Here

    final ManageableUnstructuredMarketDataSnapshot object = new ManageableUnstructuredMarketDataSnapshot();
    for (final FudgeField fudgeField : message.getAllByOrdinal(1)) {
      final FudgeMsg innerValue = (FudgeMsg) fudgeField.getValue();
      final ExternalIdBundle identifiers = deserializer.fieldValueToObject(ExternalIdBundle.class, innerValue.getByName(IDENTIFIERS_FIELD_NAME));
      final String valueName = innerValue.getFieldValue(String.class, innerValue.getByName(VALUE_NAME_FIELD_NAME));
      final FudgeField valueField = innerValue.getByName(VALUE_FIELD_NAME);
      final ValueSnapshot value = valueField == null ? null : deserializer.fieldValueToObject(ValueSnapshot.class, valueField);
      object.putValue(identifiers, valueName, value);
    }
    return object;
  }
View Full Code Here

   * @return a snapshot object
   */
  public static ManageableVolatilityCubeSnapshot fromFudgeMsg(FudgeDeserializer deserializer, FudgeMsg msg) {
    final ManageableVolatilityCubeSnapshot ret = new ManageableVolatilityCubeSnapshot();
    ret.setValues(readValues(deserializer, msg));
    FudgeField otherValues = msg.getByName("otherValues");
    if (otherValues != null) {
      ret.setOtherValues(deserializer.fieldValueToObject(ManageableUnstructuredMarketDataSnapshot.class, otherValues));
    }
    ret.setStrikes(readStrikes(deserializer, msg));
    return ret;
View Full Code Here

  }

  protected static SimpleTrade buildObjectImpl(final FudgeDeserializer deserializer, final FudgeMsg message) {
    SimpleSecurityLink secLink = new SimpleSecurityLink();
    if (message.hasField(SECURITY_KEY_FIELD_NAME)) {
      FudgeField secKeyField = message.getByName(SECURITY_KEY_FIELD_NAME);
      if (secKeyField != null) {
        secLink.setExternalId(deserializer.fieldValueToObject(ExternalIdBundle.class, secKeyField));
      }
    }
    if (message.hasField(SECURITY_ID_FIELD_NAME)) {
      FudgeField secIdField = message.getByName(SECURITY_ID_FIELD_NAME);
      if (secIdField != null) {
        secLink.setObjectId(deserializer.fieldValueToObject(ObjectId.class, secIdField));
      }
    }
   
    SimpleTrade trade = new SimpleTrade();
    trade.setSecurityLink(secLink);
    if (message.hasField(UNIQUE_ID_FIELD_NAME)) {
      FudgeField uniqueIdField = message.getByName(UNIQUE_ID_FIELD_NAME);
      if (uniqueIdField != null) {
        trade.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdField));
      }     
    }
    if (message.hasField(QUANTITY_FIELD_NAME)) {
      FudgeField quantityField = message.getByName(QUANTITY_FIELD_NAME);
      if (quantityField != null) {
        trade.setQuantity(message.getFieldValue(BigDecimal.class, quantityField));
      }
    }
    if (message.hasField(COUNTERPARTY_FIELD_NAME)) {
      FudgeField counterpartyField = message.getByName(COUNTERPARTY_FIELD_NAME);
      if (counterpartyField != null) {
        trade.setCounterparty(new SimpleCounterparty(deserializer.fieldValueToObject(ExternalId.class, counterpartyField)));
      }
    }
    if (message.hasField(TRADE_DATE_FIELD_NAME)) {
      FudgeField tradeDateField = message.getByName(TRADE_DATE_FIELD_NAME);
      if (tradeDateField != null) {
        trade.setTradeDate(message.getFieldValue(LocalDate.class, tradeDateField));
      }
    }
    if (message.hasField(TRADE_TIME_FIELD_NAME)) {
      FudgeField tradeTimeField = message.getByName(TRADE_TIME_FIELD_NAME);
      if (tradeTimeField != null) {
        trade.setTradeTime(message.getFieldValue(OffsetTime.class, tradeTimeField));
      }
    }
    if (message.hasField(PREMIUM_FIELD_NAME)) {
      trade.setPremium(message.getDouble(PREMIUM_FIELD_NAME));
    }
    if (message.hasField(PREMIUM_CURRENCY_FIELD_NAME)) {
      String currencyCode = message.getString(PREMIUM_CURRENCY_FIELD_NAME);
      if (currencyCode != null) {
        trade.setPremiumCurrency(Currency.of(currencyCode));
      }
    }
    if (message.hasField(PREMIUM_DATE_FIELD_NAME)) {
      FudgeField premiumDate = message.getByName(PREMIUM_DATE_FIELD_NAME);
      if (premiumDate != null) {
        trade.setPremiumDate(message.getFieldValue(LocalDate.class, premiumDate));
      }
    }
    if (message.hasField(PREMIUM_TIME_FIELD_NAME)) {
      FudgeField premiumTime = message.getByName(PREMIUM_TIME_FIELD_NAME);
      if (premiumTime != null) {
        trade.setPremiumTime(message.getFieldValue(OffsetTime.class, premiumTime));
      }
    }
    if (message.hasField(ATTRIBUTES_FIELD_NAME)) {
View Full Code Here

      throw new IllegalArgumentException("Invalid type", e);
    }
    final String name = msg.getString(Meta.INSTANCE.name().name());
    final Object value = deserializer.fieldValueToObject(type, msg.getByName(Meta.INSTANCE.value().name()));
    final ConfigItem<?> item = ConfigItem.of(value, name, type);
    final FudgeField uniqueId = msg.getByName(Meta.INSTANCE.uniqueId().name());
    if (uniqueId != null) {
      item.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueId));
    }
    return item;
  }
View Full Code Here

  }

  protected static SimplePosition buildObjectImpl(final FudgeDeserializer deserializer, final FudgeMsg message) {
    SimpleSecurityLink secLink = new SimpleSecurityLink();
    if (message.hasField(SECURITY_KEY_FIELD_NAME)) {
      FudgeField secKeyField = message.getByName(SECURITY_KEY_FIELD_NAME);
      if (secKeyField != null) {
        secLink.setExternalId(deserializer.fieldValueToObject(ExternalIdBundle.class, secKeyField));
      }
    }
    if (message.hasField(SECURITY_ID_FIELD_NAME)) {
      FudgeField secIdField = message.getByName(SECURITY_ID_FIELD_NAME);
      if (secIdField != null) {
        secLink.setObjectId(deserializer.fieldValueToObject(ObjectId.class, secIdField));
      }
    }
   
    SimplePosition position = new SimplePosition();
    position.setSecurityLink(secLink);
    if (message.hasField(UNIQUE_ID_FIELD_NAME)) {
      FudgeField uniqueIdField = message.getByName(UNIQUE_ID_FIELD_NAME);
      if (uniqueIdField != null) {
        position.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdField));
      }     
    }
    if (message.hasField(QUANTITY_FIELD_NAME)) {
      FudgeField quantityField = message.getByName(QUANTITY_FIELD_NAME);
      if (quantityField != null) {
        position.setQuantity(message.getFieldValue(BigDecimal.class, quantityField));
      }
    }
    if (message.hasField(ATTRIBUTES_FIELD_NAME)) {
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.