MCPcopy Create free account
hub / github.com/MenoData/Time4J / withValue

Method withValue

base/src/main/java/net/time4j/Weekmodel.java:1871–1890  ·  view source on GitHub ↗
(
            T context,
            Integer value,
            boolean lenient
        )

Source from the content-addressed store, hash-verified

1869 }
1870
1871 @Override
1872 public T withValue(
1873 T context,
1874 Integer value,
1875 boolean lenient
1876 ) {
1877
1878 PlainDate date = context.get(CALENDAR_DATE);
1879
1880 if ((value == null) || (!lenient && !this.isValid(context, value))) {
1881 throw new IllegalArgumentException(
1882 "Invalid value: " + value + " (context=" + context + ")");
1883 }
1884
1885 return context.with(
1886 CALENDAR_DATE,
1887 this.setWeek(date, value.intValue())
1888 );
1889
1890 }
1891
1892 private int getWeek(PlainDate date) {
1893

Callers

nothing calls this directly

Calls 4

isValidMethod · 0.95
setWeekMethod · 0.95
getMethod · 0.65
withMethod · 0.65

Tested by

no test coverage detected