Example #1
0
 protected Result(
     final org.fudgemsg.mapping.FudgeDeserializationContext fudgeContext,
     final org.fudgemsg.FudgeMsg fudgeMsg) {
   super(fudgeContext, fudgeMsg);
   org.fudgemsg.FudgeField fudgeField;
   fudgeField = fudgeMsg.getByName(RESULT_KEY);
   if (fudgeField == null)
     throw new IllegalArgumentException(
         "Fudge message is not a Result - field 'result' is not present");
   try {
     _result =
         fudgeContext.fieldValueToObject(
             com.opengamma.engine.view.calcnode.CalculationJobResult.class, fudgeField);
   } catch (IllegalArgumentException e) {
     throw new IllegalArgumentException(
         "Fudge message is not a Result - field 'result' is not CalculationJobResult message", e);
   }
   fudgeField = fudgeMsg.getByName(READY_KEY);
   if (fudgeField != null) {
     try {
       final com.opengamma.engine.view.calcnode.msg.Ready fudge1;
       fudge1 =
           com.opengamma.engine.view.calcnode.msg.Ready.fromFudgeMsg(
               fudgeContext, fudgeMsg.getFieldValue(org.fudgemsg.FudgeMsg.class, fudgeField));
       setReady(fudge1);
     } catch (IllegalArgumentException e) {
       throw new IllegalArgumentException(
           "Fudge message is not a Result - field 'ready' is not Ready message", e);
     }
   }
 }
 @Override
 public CurveBuildingBlockBundle buildObject(
     final FudgeDeserializer deserializer, final FudgeMsg message) {
   final List<FudgeField> curveNames = message.getAllByName(CURVE_NAME_FIELD);
   final List<FudgeField> blocks = message.getAllByName(BLOCK_FIELD);
   final List<FudgeField> matrices = message.getAllByName(MATRIX_FIELD);
   final int n = curveNames.size();
   if (blocks.size() != n) {
     throw new IllegalStateException(
         "Should have one block for each curve name; have " + curveNames + " and " + blocks);
   }
   if (matrices.size() != n) {
     throw new IllegalStateException(
         "Should have one matrix for each curve name; have " + curveNames + " and " + matrices);
   }
   final LinkedHashMap<String, Pair<CurveBuildingBlock, DoubleMatrix2D>> data =
       new LinkedHashMap<>();
   for (int i = 0; i < n; i++) {
     final String curveName = (String) curveNames.get(i).getValue();
     final CurveBuildingBlock block =
         deserializer.fieldValueToObject(CurveBuildingBlock.class, blocks.get(i));
     final DoubleMatrix2D m =
         new DoubleMatrix2D(deserializer.fieldValueToObject(double[][].class, matrices.get(i)));
     data.put(curveName, Pair.of(block, m));
   }
   return new CurveBuildingBlockBundle(data);
 }
 public static FlexiDateTime fromFudgeMsg(
     final FudgeDeserializer deserializer, final FudgeMsg msg) {
   if (msg == null) {
     return null;
   }
   final ZoneId zone = msg.getValue(ZoneId.class, ZONE_FIELD_NAME);
   final Object obj = msg.getValue(DATETIME_FIELD_NAME);
   if (obj instanceof FudgeDateTime) {
     FudgeDateTime fudge = (FudgeDateTime) obj;
     if (fudge.getTime().hasTimezoneOffset()) {
       OffsetDateTime odt = fudge.toOffsetDateTime();
       if (zone != null) {
         return FlexiDateTime.of(odt.atZoneSameInstant(zone));
       }
       return FlexiDateTime.of(odt);
     } else {
       return FlexiDateTime.of(fudge.toLocalDateTime());
     }
   } else if (obj instanceof FudgeDate) {
     FudgeDate fudge = (FudgeDate) obj;
     return FlexiDateTime.of(fudge.toLocalDate());
   } else if (obj instanceof OffsetDateTime) {
     OffsetDateTime odt = (OffsetDateTime) obj;
     if (zone != null) {
       return FlexiDateTime.of(odt.atZoneSameInstant(zone));
     }
     return FlexiDateTime.of(odt);
   } else if (obj instanceof LocalDateTime) {
     return FlexiDateTime.of((LocalDateTime) obj);
   } else if (obj instanceof LocalDate) {
     return FlexiDateTime.of((LocalDate) obj);
   } else {
     throw new IllegalStateException("Fudge message did not contain a valid date-time");
   }
 }
Example #4
0
 @Test
 public void testGetBulkSecuritiesByUniqueId() {
   final FudgeMsgEnvelope fme =
       getSecuritySourceResource()
           .getSecurities(Lists.newArrayList(_uid1.toString(), _uid2.toString()));
   assertNotNull(fme);
   final FudgeMsg msg = fme.getMessage();
   assertNotNull(msg);
   FudgeMsgFormatter.outputToSystemOut(msg);
   final Collection<FudgeField> securities = msg.getAllByName(SECURITYSOURCE_SECURITY);
   assertNotNull(securities);
   assertEquals(2, securities.size());
   FudgeDeserializer deserializer =
       new FudgeDeserializer(getSecuritySourceResource().getFudgeContext());
   for (FudgeField fudgeField : securities) {
     assertNotNull(fudgeField);
     ObjectsPair<UniqueId, Security> objectsPair =
         ObjectsPairFudgeBuilder.buildObject(
             deserializer, (FudgeMsg) fudgeField.getValue(), UniqueId.class, Security.class);
     assertNotNull(objectsPair);
     UniqueId uniqueId = objectsPair.getKey();
     assertNotNull(uniqueId);
     Security security = objectsPair.getValue();
     assertNotNull(security);
   }
 }
  @Override
  public YieldCurveBundle buildObject(
      final FudgeDeserializer deserializer, final FudgeMsg message) {
    // note name in curve & name in bundle may be different!
    final List<FudgeField> curveFields = message.getAllByName(CURVES_FIELD_NAME);
    final List<FudgeField> curveNameFields = message.getAllByName(CURVES_NAME_FIELD_NAME);
    final List<FudgeField> ccyFields = message.getAllByName(CURRENCY_FIELD_NAME);
    final List<FudgeField> ccyCurveFields = message.getAllByName(CURRENCY_CURVE_FIELD_NAME);
    final Map<String, YieldAndDiscountCurve> curves = new LinkedHashMap<>(curveFields.size());
    final Map<String, Currency> curveCurrencys = Maps.newHashMapWithExpectedSize(ccyFields.size());
    final FXMatrix fxMatrix =
        deserializer.fieldValueToObject(FXMatrix.class, message.getByName(FX_MATRIX_FIELD_NAME));
    for (int i = 0; i < curveFields.size(); i++) {
      final YieldAndDiscountCurve curve =
          deserializer.fieldValueToObject(YieldAndDiscountCurve.class, curveFields.get(i));
      final String name = deserializer.fieldValueToObject(String.class, curveNameFields.get(i));
      curves.put(name, curve);
    }
    for (int i = 0; i < ccyFields.size(); i++) {
      final String name = deserializer.fieldValueToObject(String.class, ccyCurveFields.get(i));
      final Currency ccy = deserializer.fieldValueToObject(Currency.class, ccyFields.get(i));
      curveCurrencys.put(name, ccy);
    }

    return new YieldCurveBundle(fxMatrix, curveCurrencys, curves);
  }
 @Override
 public CurveBuildingBlock buildObject(
     final FudgeDeserializer deserializer, final FudgeMsg message) {
   final List<FudgeField> curveNames = message.getAllByName(CURVE_NAME_FIELD);
   final List<FudgeField> startIndices = message.getAllByName(START_INDEX_FIELD);
   final int n = curveNames.size();
   if (startIndices.size() != n) {
     throw new IllegalStateException(
         "Should have one start index for each curve name; have "
             + curveNames
             + " and "
             + startIndices);
   }
   final List<FudgeField> numbers = message.getAllByName(NUMBER_FIELD);
   if (numbers.size() != n) {
     throw new IllegalStateException(
         "Should have one parameter number for each curve name; have "
             + curveNames
             + " and "
             + numbers);
   }
   final LinkedHashMap<String, Pair<Integer, Integer>> data = new LinkedHashMap<>();
   for (int i = 0; i < n; i++) {
     final String curveName = (String) curveNames.get(i).getValue();
     final Integer startIndex = ((Number) startIndices.get(i).getValue()).intValue();
     final Integer number = ((Number) numbers.get(i).getValue()).intValue();
     data.put(curveName, Pair.of(startIndex, number));
   }
   return new CurveBuildingBlock(data);
 }
 @Override
 public MoneynessPiecewiseSABRSurfaceFitter buildObject(
     final FudgeDeserializer deserializer, final FudgeMsg message) {
   final boolean useLogTime = message.getBoolean(TIME_FIELD_NAME);
   final boolean useIntegratedVar = message.getBoolean(SPACE_FIELD_NAME);
   final double lambda = message.getDouble(LAMBDA_FIELD_NAME);
   return new MoneynessPiecewiseSABRSurfaceFitter(useLogTime, useIntegratedVar, lambda);
 }
Example #8
0
 private void checkSecurityMessage(final FudgeMsgEnvelope fme) {
   assertNotNull(fme);
   final FudgeMsg msg = fme.getMessage();
   assertNotNull(msg);
   FudgeMsgFormatter.outputToSystemOut(msg);
   final FudgeMsg security =
       msg.getFieldValue(FudgeMsg.class, msg.getByName(SECURITYSOURCE_SECURITY));
   assertNotNull(security);
 }
 @Override
 public IndexON buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
   final String name = message.getString(NAME_FIELD);
   final Currency currency = Currency.of(message.getString(CURRENCY_FIELD));
   final DayCount dayCount =
       DayCountFactory.INSTANCE.getDayCount(message.getString(DAY_COUNT_FIELD));
   final int publicationLag = message.getInt(PUBLICATION_LAG_FIELD);
   return new IndexON(name, currency, dayCount, publicationLag);
 }
Example #10
0
 private void checkSecuritiesMessage(final FudgeMsgEnvelope fme) {
   assertNotNull(fme);
   final FudgeMsg msg = fme.getMessage();
   assertNotNull(msg);
   FudgeMsgFormatter.outputToSystemOut(msg);
   final Collection<FudgeField> securities = msg.getAllByName(SECURITYSOURCE_SECURITY);
   assertNotNull(securities);
   assertEquals(2, securities.size());
 }
 @Override
 public CycleExecutionFailedCall buildObject(FudgeDeserializationContext context, FudgeMsg msg) {
   ViewCycleExecutionOptions cycleExecutionOptions =
       context.fieldValueToObject(
           ViewCycleExecutionOptions.class, msg.getByName(EXECUTION_OPTIONS_FIELD));
   FudgeField exceptionField = msg.getByName(EXCEPTION_FIELD);
   Exception exception =
       exceptionField != null ? context.fieldValueToObject(Exception.class, exceptionField) : null;
   return new CycleExecutionFailedCall(cycleExecutionOptions, exception);
 }
Example #12
0
 @Test
 public void testGetAllBondsOfIssuerType() {
   final FudgeMsgEnvelope fme =
       getSecuritySourceResource().getBondsWithIssuerName("US TREASURY N/B");
   assertNotNull(fme);
   final FudgeMsg msg = fme.getMessage();
   assertNotNull(msg);
   FudgeMsgFormatter.outputToSystemOut(msg);
   final Collection<FudgeField> securities = msg.getAllByName(SECURITYSOURCE_SECURITY);
   assertNotNull(securities);
   assertEquals(1, securities.size());
 }
 public static Entry fromFudgeMsg(final FudgeDeserializer context, final FudgeMsg msg) {
   final Entry e = new Entry();
   final Iterator<FudgeField> keys = msg.getAllByOrdinal(1).iterator();
   final Iterator<FudgeField> values = msg.getAllByOrdinal(2).iterator();
   while (keys.hasNext() && values.hasNext()) {
     final FudgeField key = keys.next();
     final FudgeField value = values.next();
     e.add(
         context.fieldValueToObject(ExternalIdBundle.class, key),
         context.fieldValueToObject(HistoricalTimeSeries.class, value));
   }
   return e;
 }
 @Override
 public ZonedDateTime buildObject(FudgeDeserializationContext context, FudgeMsg msg) {
   final OffsetDateTime odt = msg.getValue(OffsetDateTime.class, ODT_FIELD_NAME);
   if (odt == null) {
     throw new IllegalArgumentException(
         "Fudge message is not a ZonedDateTime - field 'odt' is not present");
   }
   final String zone = msg.getString(ZONE_FIELD_NAME);
   if (zone == null) {
     throw new IllegalArgumentException(
         "Fudge message is not a ZonedDateTime - field 'zone' is not present");
   }
   return ZonedDateTime.of(odt, TimeZone.of(zone));
 }
Example #15
0
  // -------------------------------------------------------------------------
  @SuppressWarnings("unchecked")
  @Override
  public T buildObject(FudgeDeserializer deserializer, FudgeMsg outerMsg) {
    FudgeField fudgeField = outerMsg.getByName("inner");
    FudgeMsg msg = (FudgeMsg) fudgeField.getValue();

    final FudgeField classNameField = msg.getByOrdinal(FudgeSerializer.TYPES_HEADER_ORDINAL);
    final String className = (String) classNameField.getValue();
    try {
      final List<Object> parameters = newArrayList();
      parameters.add(null); // the omitted enclosing object
      for (FudgeField parameterField : msg.getAllByOrdinal(1)) {
        parameters.add(deserializer.fieldValueToObject(parameterField));
      }

      return (T)
          AccessController.doPrivileged(
              new PrivilegedAction<Object>() {
                @Override
                public Object run() {
                  try {
                    final Class<?> innerClass = Class.forName(className);
                    final Constructor<?>[] ctors = innerClass.getDeclaredConstructors();
                    // We require that inner classes got only one ctor (anonymous inner classes will
                    // do)
                    // in order to avoid disambiguity
                    if (ctors.length == 1) {
                      final Constructor<?> ctor = ctors[0];
                      ctor.setAccessible(true); // solution
                      Object inner = ctor.newInstance(parameters.toArray());
                      return new AutoFudgable<Object>(inner);
                    }
                  } catch (IllegalAccessException e) {
                    throw new RuntimeException(e);
                  } catch (InstantiationException e) {
                    throw new RuntimeException(e);
                  } catch (InvocationTargetException e) {
                    throw new RuntimeException(e);
                  } catch (ClassNotFoundException e) {
                    throw new RuntimeException(e);
                  }
                  return null;
                }
              });

    } catch (RuntimeException ex) {
      throw new FudgeRuntimeException("Unable to deserialize: " + className, ex);
    }
  }
 @Override
 public StandardSmileSurfaceDataBundle buildObject(
     final FudgeDeserializer deserializer, final FudgeMsg message) {
   final ForwardCurve forwardCurve =
       deserializer.fieldValueToObject(
           ForwardCurve.class, message.getByName(FORWARD_CURVE_FIELD_NAME));
   final double[] expiries =
       deserializer.fieldValueToObject(double[].class, message.getByName(EXPIRIES_FIELD_NAME));
   final double[][] strikes =
       deserializer.fieldValueToObject(double[][].class, message.getByName(STRIKES_FIELD_NAME));
   final double[][] vols =
       deserializer.fieldValueToObject(double[][].class, message.getByName(VOLS_FIELD_NAME));
   final boolean isCallData = message.getBoolean(IS_CALL_FIELD_NAME);
   return new StandardSmileSurfaceDataBundle(forwardCurve, expiries, strikes, vols, isCallData);
 }
Example #17
0
 @Override
 public DoubleMatrix2D buildObject(
     final FudgeDeserializer deserializer, final FudgeMsg message) {
   final double[][] data =
       deserializer.fieldValueToObject(double[][].class, message.getByName(DATA_FIELD_NAME));
   return new DoubleMatrix2D(data);
 }
 protected Set<ComputationTargetSpecification> decodeComputationTargets(
     final FudgeDeserializer deserializer, final FudgeMsg msg) {
   final FudgeMsg submsg = msg.getMessage(COMPUTATION_TARGETS_FIELD);
   if (submsg == null) {
     return Collections.emptySet();
   }
   final Set<ComputationTargetSpecification> result =
       Sets.newHashSetWithExpectedSize(submsg.getNumFields());
   for (final FudgeField field : submsg) {
     result.add(
         deserializer
             .fieldValueToObject(ComputationTargetReference.class, field)
             .getSpecification());
   }
   return result;
 }
 public static void fromFudgeMsg(
     FudgeDeserializer deserializer, FudgeMsg msg, EnergyFutureSecurity object) {
   CommodityFutureSecurityFudgeBuilder.fromFudgeMsg(deserializer, msg, object);
   object.setUnderlyingId(
       ExternalIdFudgeBuilder.fromFudgeMsg(
           deserializer, msg.getMessage(UNDERLYING_IDENTIFIER_FIELD_NAME)));
 }
 protected SimpleChooserPayoffStyle(
     final org.fudgemsg.mapping.FudgeDeserializationContext fudgeContext,
     final org.fudgemsg.FudgeMsg fudgeMsg) {
   super(fudgeContext, fudgeMsg);
   org.fudgemsg.FudgeField fudgeField;
   fudgeField = fudgeMsg.getByName(CHOOSE_DATE_KEY);
   if (fudgeField == null)
     throw new IllegalArgumentException(
         "Fudge message is not a SimpleChooserPayoffStyle - field 'chooseDate' is not present");
   try {
     _chooseDate =
         fudgeContext.fieldValueToObject(javax.time.calendar.ZonedDateTime.class, fudgeField);
   } catch (IllegalArgumentException e) {
     throw new IllegalArgumentException(
         "Fudge message is not a SimpleChooserPayoffStyle - field 'chooseDate' is not ZonedDateTime typedef",
         e);
   }
   fudgeField = fudgeMsg.getByName(UNDERLYING_STRIKE_KEY);
   if (fudgeField == null)
     throw new IllegalArgumentException(
         "Fudge message is not a SimpleChooserPayoffStyle - field 'underlyingStrike' is not present");
   try {
     _underlyingStrike = fudgeMsg.getFieldValue(Double.class, fudgeField);
   } catch (IllegalArgumentException e) {
     throw new IllegalArgumentException(
         "Fudge message is not a SimpleChooserPayoffStyle - field 'underlyingStrike' is not double",
         e);
   }
   fudgeField = fudgeMsg.getByName(UNDERLYING_EXPIRY_KEY);
   if (fudgeField == null)
     throw new IllegalArgumentException(
         "Fudge message is not a SimpleChooserPayoffStyle - field 'underlyingExpiry' is not present");
   try {
     _underlyingExpiry =
         com.opengamma.util.time.Expiry.fromFudgeMsg(
             fudgeContext, fudgeMsg.getFieldValue(org.fudgemsg.FudgeMsg.class, fudgeField));
   } catch (IllegalArgumentException e) {
     throw new IllegalArgumentException(
         "Fudge message is not a SimpleChooserPayoffStyle - field 'underlyingExpiry' is not Expiry message",
         e);
   }
 }
    @SuppressWarnings("synthetic-access")
    @Override
    public CurrencyLabelledMatrix1D buildObject(
        final FudgeDeserializer deserializer, final FudgeMsg message) {
      final FudgeMsg msg = message.getMessage(MATRIX_FIELD_NAME);

      final Queue<String> labelTypes = new LinkedList<String>();
      final Queue<FudgeField> labelValues = new LinkedList<FudgeField>();

      final List<Currency> keys = new LinkedList<Currency>();
      final List<Object> labels = new LinkedList<Object>();
      final List<Double> values = new LinkedList<Double>();

      for (final FudgeField field : msg) {
        switch (field.getOrdinal()) {
          case LABEL_TYPE_ORDINAL:
            labelTypes.add((String) field.getValue());
            break;
          case KEY_ORDINAL:
            keys.add(Currency.of((String) field.getValue()));
            break;
          case LABEL_ORDINAL:
            labelValues.add(field);
            break;
          case VALUE_ORDINAL:
            values.add((Double) field.getValue());
            break;
        }

        if (!labelTypes.isEmpty() && !labelValues.isEmpty()) {
          // Have a type and a value, which can be consumed
          final String labelType = labelTypes.remove();
          Class<?> labelClass;
          try {
            labelClass = LabelledMatrix1DBuilder.getLabelClass(labelType, _loadedClasses);
          } catch (final ClassNotFoundException ex) {
            throw new OpenGammaRuntimeException(
                "Could not deserialize label of type " + labelType, ex);
          }
          final FudgeField labelValue = labelValues.remove();
          final Object label = deserializer.fieldValueToObject(labelClass, labelValue);
          //          labels.add(Currency.of((String) label));
          labels.add(label);
        }
      }

      final int matrixSize = keys.size();
      final Currency[] keysArray = new Currency[matrixSize];
      keys.toArray(keysArray);
      final Object[] labelsArray = new Object[matrixSize];
      labels.toArray(labelsArray);
      final double[] valuesArray = Doubles.toArray(values);
      return new CurrencyLabelledMatrix1D(keysArray, labelsArray, valuesArray);
    }
  public void fudgeEncoding() {
    List<HistoricalTimeSeriesRatingRule> rules = new ArrayList<HistoricalTimeSeriesRatingRule>();
    rules.add(HistoricalTimeSeriesRatingRule.of(DATA_SOURCE_NAME, "BLOOMBERG", 2));
    rules.add(HistoricalTimeSeriesRatingRule.of(DATA_SOURCE_NAME, "REUTERS", 1));
    rules.add(HistoricalTimeSeriesRatingRule.of(DATA_PROVIDER_NAME, "CMPL", 3));
    HistoricalTimeSeriesRating inputConfig = HistoricalTimeSeriesRating.of(rules);

    FudgeSerializer serializationContext = new FudgeSerializer(s_fudgeContext);
    MutableFudgeMsg inputMsg = serializationContext.objectToFudgeMsg(inputConfig);
    FudgeMsg outputMsg =
        s_fudgeContext.deserialize(s_fudgeContext.toByteArray(inputMsg)).getMessage();
    assertNotNull(outputMsg);
    assertEquals(3, outputMsg.getNumFields());

    FudgeDeserializer deserializationContext = new FudgeDeserializer(s_fudgeContext);
    HistoricalTimeSeriesRating outputConfig =
        deserializationContext.fudgeMsgToObject(HistoricalTimeSeriesRating.class, outputMsg);

    assertEquals(inputConfig, outputConfig);
  }
 @Override
 public Position buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
   final SimplePosition position = buildObjectImpl(deserializer, message);
   final FudgeField parentField = message.getByName(FIELD_PARENT);
   final UniqueId parentId =
       (parentField != null) ? deserializer.fieldValueToObject(UniqueId.class, parentField) : null;
   if (parentId != null) {
     position.setParentNodeId(parentId);
   }
   return position;
 }
 @Override
 public SimpleHistoricalTimeSeries buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
   UniqueId uniqueId = null;
   LocalDateDoubleTimeSeries timeseries = null;
   if (message.getByName(UNIQUE_ID_FIELD_NAME) != null) {
     uniqueId =
         deserializer.fieldValueToObject(UniqueId.class, message.getByName(UNIQUE_ID_FIELD_NAME));
   }
   if (message.hasField(TIMESERIES_FIELD_NAME)) {
     Object fieldValue = deserializer.fieldValueToObject(message.getByName(TIMESERIES_FIELD_NAME));
     if (fieldValue instanceof LocalDateDoubleTimeSeries) {
       timeseries = (LocalDateDoubleTimeSeries) fieldValue;
     }
   }
   if (uniqueId != null && timeseries != null) {
     return new SimpleHistoricalTimeSeries(uniqueId, timeseries);
   } else {
     throw new OpenGammaRuntimeException(
         "Cannot deserialize " + message + " to SimpleHistoricalTimeSeries");
   }
 }
 @Override
 public InflationProviderDiscount buildObject(
     final FudgeDeserializer deserializer, final FudgeMsg message) {
   final MulticurveProviderDiscount yieldCurves =
       deserializer.fieldValueToObject(
           MulticurveProviderDiscount.class, message.getByName(YIELD_CURVES_FIELD));
   final List<FudgeField> indexFields = message.getAllByName(PRICE_INDEX_FIELD);
   final List<FudgeField> indexCurveFields = message.getAllByName(PRICE_INDEX_CURVE_FIELD);
   final Map<IndexPrice, PriceIndexCurve> priceIndexCurves = new LinkedHashMap<>();
   final int n = indexFields.size();
   for (int i = 0; i < n; i++) {
     final IndexPrice index =
         deserializer.fudgeMsgToObject(
             IndexPrice.class, (FudgeMsg) indexFields.get(i).getValue());
     final PriceIndexCurve curve =
         deserializer.fudgeMsgToObject(
             PriceIndexCurve.class, (FudgeMsg) indexCurveFields.get(i).getValue());
     priceIndexCurves.put(index, curve);
   }
   return new InflationProviderDiscount(yieldCurves, priceIndexCurves);
 }
 public static void fromFudgeMsg(
     FudgeDeserializer deserializer, FudgeMsg msg, EquitySecurity object) {
   FinancialSecurityFudgeBuilder.fromFudgeMsg(deserializer, msg, object);
   object.setShortName(msg.getString(SHORT_NAME_FIELD_NAME));
   object.setExchange(msg.getString(EXCHANGE_FIELD_NAME));
   object.setExchangeCode(msg.getString(EXCHANGE_CODE_FIELD_NAME));
   object.setCompanyName(msg.getString(COMPANY_NAME_FIELD_NAME));
   object.setCurrency(msg.getValue(Currency.class, CURRENCY_FIELD_NAME));
   object.setGicsCode(msg.getValue(GICSCode.class, GICS_CODE_FIELD_NAME));
   object.setPreferred(BooleanUtils.isTrue(msg.getBoolean(PREFERRED_FIELD_NAME)));
 }
  @Override
  public CalculationJobItem buildObject(FudgeDeserializer deserializer, FudgeMsg message) {

    ComputationTargetSpecification computationTargetSpecification =
        deserializer.fudgeMsgToObject(ComputationTargetSpecification.class, message);
    Validate.notNull(
        computationTargetSpecification,
        "Fudge message is not a CalculationJobItem - field 'computationTargetSpecification' is not present");

    String functionUniqueId = message.getString(FUNCTION_UNIQUE_ID_FIELD_NAME);
    Validate.notNull(
        functionUniqueId,
        "Fudge message is not a CalculationJobItem - field 'functionUniqueIdentifier' is not present");

    FudgeField fudgeField = message.getByName(FUNCTION_PARAMETERS_FIELD_NAME);
    Validate.notNull(
        fudgeField,
        "Fudge message is not a CalculationJobItem - field 'functionParameters' is not present");
    FunctionParameters functionParameters =
        deserializer.fieldValueToObject(FunctionParameters.class, fudgeField);

    final long[] inputIdentifiers = (long[]) message.getByName(INPUT_FIELD_NAME).getValue();

    List<ValueRequirement> desiredValues = new ArrayList<ValueRequirement>();
    for (FudgeField field : message.getAllByName(DESIRED_VALUE_FIELD_NAME)) {
      FudgeMsg valueMsg = (FudgeMsg) field.getValue();
      ValueRequirement desiredValue =
          deserializer.fudgeMsgToObject(ValueRequirement.class, valueMsg);
      desiredValues.add(desiredValue);
    }

    return CalculationJobItem.create(
        functionUniqueId,
        functionParameters,
        computationTargetSpecification,
        inputIdentifiers,
        desiredValues);
  }
 /**
  * Deserializes this pair from a Fudge message.
  *
  * @param fudgeContext the Fudge context
  * @param msg the Fudge message, not null
  * @return the pair, not null
  */
 public static IdentifierBundleWithDates fromFudgeMsg(
     FudgeDeserializationContext fudgeContext, FudgeMsg msg) {
   Set<IdentifierWithDates> identifiers = new HashSet<IdentifierWithDates>();
   for (FudgeField field : msg.getAllByName(ID_FUDGE_FIELD_NAME)) {
     if (field.getValue() instanceof FudgeMsg == false) {
       throw new IllegalArgumentException(
           "Message provider has field named "
               + ID_FUDGE_FIELD_NAME
               + " which doesn't contain a sub-Message");
     }
     identifiers.add(IdentifierWithDates.fromFudgeMsg(fudgeContext, (FudgeMsg) field.getValue()));
   }
   return new IdentifierBundleWithDates(identifiers);
 }
 protected EntitlementResponseMsg(
     final org.fudgemsg.mapping.FudgeDeserializer deserializer,
     final org.fudgemsg.FudgeMsg fudgeMsg) {
   java.util.List<org.fudgemsg.FudgeField> fudgeFields;
   fudgeFields = fudgeMsg.getAllByName(RESPONSES_KEY);
   if (fudgeFields.size() == 0)
     throw new IllegalArgumentException(
         "Fudge message is not a EntitlementResponseMsg - field 'responses' is not present");
   _responses =
       new java.util.ArrayList<com.opengamma.livedata.msg.EntitlementResponse>(fudgeFields.size());
   for (org.fudgemsg.FudgeField fudge1 : fudgeFields) {
     try {
       final com.opengamma.livedata.msg.EntitlementResponse fudge2;
       fudge2 =
           com.opengamma.livedata.msg.EntitlementResponse.fromFudgeMsg(
               deserializer, fudgeMsg.getFieldValue(org.fudgemsg.FudgeMsg.class, fudge1));
       _responses.add(fudge2);
     } catch (IllegalArgumentException e) {
       throw new IllegalArgumentException(
           "Fudge message is not a EntitlementResponseMsg - field 'responses' is not EntitlementResponse message",
           e);
     }
   }
 }
 @Override
 public IborIndex buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
   final Currency currency = Currency.of(message.getString(CURRENCY_FIELD));
   final int spotLag = message.getInt(SPOT_LAG_FIELD);
   final DayCount dayCount =
       DayCountFactory.INSTANCE.getDayCount(message.getString(DAY_COUNT_FIELD));
   final BusinessDayConvention businessDayConvention =
       BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention(
           message.getString(BUSINESS_DAY_CONVENTION_FIELD));
   final boolean isEOM = message.getBoolean(EOM_FIELD);
   final Period tenor = Period.parse(message.getString(TENOR_FIELD));
   final String name = message.getString(NAME_FIELD);
   return new IborIndex(currency, tenor, spotLag, dayCount, businessDayConvention, isEOM, name);
 }