/// <summary> /// Translate a <see cref="UnresolvedPathSegment" /> an implementation of <see cref="PathSegmentTranslator{T}" /> /// </summary> /// <typeparam name="T">Type that the translator will return after visiting this token.</typeparam> /// <param name="translator">An implementation of the translator interface.</param> /// <returns>An object whose type is determined by the type parameter of the translator.</returns> public override T TranslateWith <T>(PathSegmentTranslator <T> translator) { if (typeof(T) == typeof(string)) { return((T)(object)SegmentValue); } return(default(T)); }
/// <summary> /// Translate a <exception cref="ValueSegment"> into another object using an instance of</exception> <see cref="PathSegmentTranslator{T}"/>. /// </summary> /// <typeparam name="T">Type that the translator will return after visiting this token.</typeparam> /// <param name="translator">An implementation of the translator interface.</param> /// <returns>An object whose type is determined by the type parameter of the translator.</returns> /// <exception cref="System.ArgumentNullException">Throws if the input translator is null.</exception> public override T TranslateWith <T>(PathSegmentTranslator <T> translator) { ExceptionUtils.CheckArgumentNotNull(translator, "translator"); return(translator.Translate(this)); }
/// <summary> /// Translate a <see cref="ODataPathSegment"/> using an implemntation of<see cref="PathSegmentTranslator{T}"/>. /// </summary> /// <typeparam name="T">Type that the translator will return after visiting this token.</typeparam> /// <param name="translator">An implementation of the translator interface.</param> /// <returns>An object whose type is determined by the type parameter of the translator.</returns> public abstract T TranslateWith <T>(PathSegmentTranslator <T> translator);
public override T TranslateWith <T>(PathSegmentTranslator <T> translator) { return(default(T)); }
public IEnumerable <T> WalkWith <T>(PathSegmentTranslator <T> translator) { return(this.segments.Select(segment => segment.TranslateWith(translator))); }
public override T TranslateWith <T>(PathSegmentTranslator <T> translator) { throw new System.NotImplementedException(); }