//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: //ORIGINAL LINE: private static java.time.temporal.TemporalAccessor adjust(final java.time.temporal.TemporalAccessor temporal, DateTimeFormatter formatter) private static TemporalAccessor Adjust(TemporalAccessor temporal, DateTimeFormatter formatter) { // normal case first (early return is an optimization) Chronology overrideChrono = formatter.Chronology; ZoneId overrideZone = formatter.Zone; if (overrideChrono == null && overrideZone == null) { return(temporal); } // ensure minimal change (early return is an optimization) Chronology temporalChrono = temporal.query(TemporalQueries.Chronology()); ZoneId temporalZone = temporal.query(TemporalQueries.ZoneId()); if (Objects.Equals(overrideChrono, temporalChrono)) { overrideChrono = null; } if (Objects.Equals(overrideZone, temporalZone)) { overrideZone = null; } if (overrideChrono == null && overrideZone == null) { return(temporal); } // make adjustment //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.time.chrono.Chronology effectiveChrono = (overrideChrono != null ? overrideChrono : temporalChrono); Chronology effectiveChrono = (overrideChrono != null ? overrideChrono : temporalChrono); if (overrideZone != null) { // if have zone and instant, calculation is simple, defaulting chrono if necessary if (temporal.IsSupported(INSTANT_SECONDS)) { Chronology chrono = (effectiveChrono != null ? effectiveChrono : IsoChronology.INSTANCE); return(chrono.zonedDateTime(Instant.From(temporal), overrideZone)); } // block changing zone on OffsetTime, and similar problem cases if (overrideZone.Normalized() is ZoneOffset && temporal.IsSupported(OFFSET_SECONDS) && temporal.get(OFFSET_SECONDS) != overrideZone.Rules.GetOffset(Instant.EPOCH).TotalSeconds) { throw new DateTimeException("Unable to apply override zone '" + overrideZone + "' because the temporal object being formatted has a different offset but" + " does not represent an instant: " + temporal); } } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.time.ZoneId effectiveZone = (overrideZone != null ? overrideZone : temporalZone); ZoneId effectiveZone = (overrideZone != null ? overrideZone : temporalZone); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.time.chrono.ChronoLocalDate effectiveDate; ChronoLocalDate effectiveDate; if (overrideChrono != null) { if (temporal.IsSupported(EPOCH_DAY)) { effectiveDate = effectiveChrono.Date(temporal); } else { // check for date fields other than epoch-day, ignoring case of converting null to ISO if (!(overrideChrono == IsoChronology.INSTANCE && temporalChrono == null)) { foreach (ChronoField f in ChronoField.values()) { if (f.DateBased && temporal.IsSupported(f)) { throw new DateTimeException("Unable to apply override chronology '" + overrideChrono + "' because the temporal object being formatted contains date fields but" + " does not represent a whole date: " + temporal); } } } effectiveDate = null; } } else { effectiveDate = null; } // combine available data // this is a non-standard temporal that is almost a pure delegate // this better handles map-like underlying temporal instances return(new TemporalAccessorAnonymousInnerClassHelper(temporal, effectiveChrono, effectiveZone, effectiveDate)); }