/// <summary> /// Outputs the supplied <see cref="Oragon.Spring.Context.IMessageSourceResolvable"/> /// as a nicely formatted <see cref="System.String"/>. /// </summary> /// <param name="resolvable"> /// The <see cref="Oragon.Spring.Context.IMessageSourceResolvable"/> to output. /// </param> public string VisitMessageSourceResolvableString( IMessageSourceResolvable resolvable) { StringBuilder builder = new StringBuilder(); builder.Append("codes=["); builder.Append(StringUtils.ArrayToDelimitedString(resolvable.GetCodes(), ",")); builder.Append("]; arguments=["); if (resolvable.GetArguments() == null) { builder.Append("null"); } else { object[] arguments = resolvable.GetArguments(); for (int i = 0; i < arguments.Length; i++) { builder.Append("("); builder.Append(arguments[i].GetType().Name); builder.Append(")["); builder.Append(arguments[i]); builder.Append("]"); if (i < arguments.Length - 1) { builder.Append(", "); } } } builder.Append("]; defaultMessage=["); builder.Append(resolvable.DefaultMessage); builder.Append("]"); return(builder.ToString()); }
public void GetsAllInterfaces() { // Extend to get new interface TestObjectSubclass raw = new TestObjectSubclass(); ProxyFactory factory = new ProxyFactory(raw); Assert.AreEqual(8, factory.Interfaces.Length, "Found correct number of interfaces"); //System.out.println("Proxied interfaces are " + StringUtils.arrayToDelimitedString(factory.getProxiedInterfaces(), ",")); ITestObject tb = (ITestObject)factory.GetProxy(); Assert.IsTrue(tb is IOther, "Picked up secondary interface"); raw.Age = 25; Assert.IsTrue(tb.Age == raw.Age); DateTime t = new DateTime(2004, 8, 1); TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor(t); Console.WriteLine(StringUtils.ArrayToDelimitedString(factory.Interfaces, "/")); //factory.addAdvisor(0, new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped))); factory.AddIntroduction( new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped)) ); Console.WriteLine(StringUtils.ArrayToDelimitedString(factory.Interfaces, "/")); ITimeStamped ts = (ITimeStamped)factory.GetProxy(); Assert.IsTrue(ts.TimeStamp == t); // Shouldn't fail; ((IOther)ts).Absquatulate(); }
// CLOVER:OFF /// <summary> /// Convert the object to a string representation. /// </summary> /// <returns> /// A string representation of the object. /// </returns> public override string ToString() { IList <PropertyValue> pvs = PropertyValues; StringBuilder sb = new StringBuilder( "MutablePropertyValues: length=").Append(pvs.Count).Append("; "); sb.Append(StringUtils.ArrayToDelimitedString(pvs, ",")); return(sb.ToString()); }