public virtual void test_beanBuilder_invalid()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.joda.beans.BeanBuilder<? extends MultiCurrencyAmount> test = MultiCurrencyAmount.meta().builder().set(MultiCurrencyAmount.meta().amounts(), com.google.common.collect.ImmutableSortedSet.of(CA1, CA2, CurrencyAmount.of(CA1.getCurrency(), AMT3)));
            BeanBuilder <MultiCurrencyAmount> test = MultiCurrencyAmount.meta().builder().set(MultiCurrencyAmount.meta().amounts(), ImmutableSortedSet.of(CA1, CA2, CurrencyAmount.of(CA1.Currency, AMT3)));

            assertThrowsIllegalArg(() => test.build());
        }
示例#2
0
        protected bool ReadFromFile()
        {
            //Debug.Log("read from resource file");
            BeanBuilder builder = GetBuilder();

            string filename = GetDbFileName(builder.GetFilename());

            try
            {
                TextAsset fileres = Resources.Load <TextAsset>(filename);
                //byte[] raws = Globals.serverinfo.GetConfigINfoByName(filename.ToLower());
                byte[] raws = fileres.bytes;
                if (raws == null)
                {
                    Debug.LogError("Config file:" + filename + " not Find");
                    return(false);
                }
                int count    = GetElementCount(raws);
                int startPos = 4;
                for (int i = 0; i < count; i++)
                {
                    T ele = (T)builder.createBean();
                    startPos = ele.readFromBytes(raws, startPos);
                    if (startPos < 0)
                    {
                        Debug.LogError("read resource file failed :: " + filename);
                    }
                    beans.Add(ele);
                }
                //Debug.Log("read from resource complete");
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);

                return(false);
            }
            finally
            {
            }
            return(true);
        }
        //-------------------------------------------------------------------------
        public virtual void test_immutableViaBeanBuilder()
        {
            LocalDate[] dates  = new LocalDate[] { DATE_2010_01_01, DATE_2011_01_01, DATE_2012_01_01 };
            double[]    values = new double[] { 6, 5, 4 };
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.joda.beans.BeanBuilder<? extends LocalDateDoubleTimeSeries> builder = SparseLocalDateDoubleTimeSeries.meta().builder();
            BeanBuilder <LocalDateDoubleTimeSeries> builder = SparseLocalDateDoubleTimeSeries.meta().builder();

            builder.set("dates", dates);
            builder.set("values", values);
            LocalDateDoubleTimeSeries test = builder.build();

            dates[0]  = DATE_2012_01_01;
            values[0] = -1;
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            LocalDateDoublePoint[] points = test.ToArray(LocalDateDoublePoint[] ::new);
            assertEquals(points[0], LocalDateDoublePoint.of(DATE_2010_01_01, 6d));
            assertEquals(points[1], LocalDateDoublePoint.of(DATE_2011_01_01, 5d));
            assertEquals(points[2], LocalDateDoublePoint.of(DATE_2012_01_01, 4d));
        }
        public override object build <T1>(Type beanType, BeanBuilder <T1> builder)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.ConcurrentMap<org.joda.beans.MetaProperty<?>, Object> buffer = ((org.joda.beans.impl.BufferingBeanBuilder<?>) builder).getBuffer();
            ConcurrentMap <MetaProperty <object>, object> buffer = ((BufferingBeanBuilder <object>)builder).Buffer;
            HolidayCalendarId id = builder.get(ID);

            if (buffer.containsKey(HOLIDAYS) && buffer.containsKey(WEEKEND_DAYS))
            {
                ISet <LocalDate> holidays    = builder.get(HOLIDAYS);
                ISet <DayOfWeek> weekendDays = builder.get(WEEKEND_DAYS);
                return(ImmutableHolidayCalendar.of(id, holidays, weekendDays));
            }
            else
            {
                int   weekends  = builder.get(WEEKENDS);
                int   startYear = builder.get(START_YEAR);
                int[] lookup    = builder.get(LOOKUP);
                return(new ImmutableHolidayCalendar(id, weekends, startYear, lookup, false));
            }
        }
示例#5
0
        public override object build <T1>(Type beanType, BeanBuilder <T1> builder)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.joda.beans.impl.BufferingBeanBuilder<?> bld = (org.joda.beans.impl.BufferingBeanBuilder<?>) builder;
            BufferingBeanBuilder <object> bld = (BufferingBeanBuilder <object>)builder;
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.ConcurrentMap<org.joda.beans.MetaProperty<?>, Object> buffer = bld.getBuffer();
            ConcurrentMap <MetaProperty <object>, object> buffer = bld.Buffer;
            BusinessDayAdjustment bda = (BusinessDayAdjustment)buffer.getOrDefault(PAYMENT_ADJUSTMENT_DATE, null);

            if (buffer.containsKey(BASE_CURRENCY_AMOUNT) && buffer.containsKey(COUNTER_CURRENCY_AMOUNT) && buffer.containsKey(PAYMENT_DATE))
            {
                CurrencyAmount baseAmount    = (CurrencyAmount)builder.get(BASE_CURRENCY_AMOUNT);
                CurrencyAmount counterAmount = (CurrencyAmount)builder.get(COUNTER_CURRENCY_AMOUNT);
                LocalDate      paymentDate   = (LocalDate)builder.get(PAYMENT_DATE);
                return(bda != null?FxSingle.of(baseAmount, counterAmount, paymentDate, bda) : FxSingle.of(baseAmount, counterAmount, paymentDate));
            }
            else
            {
                Payment basePayment    = (Payment)buffer.get(BASE_CURRENCY_PAYMENT);
                Payment counterPayment = (Payment)buffer.get(COUNTER_CURRENCY_PAYMENT);
                return(bda != null?FxSingle.of(basePayment, counterPayment, bda) : FxSingle.of(basePayment, counterPayment));
            }
        }