congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Year.getValue
Code IndexAdd Tabnine to your IDE (free)

How to use
getValue
method
in
java.time.Year

Best Java code snippets using java.time.Year.getValue (Showing top 20 results out of 459)

origin: com.fasterxml.jackson.datatype/jackson-datatype-jsr310

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: prestodb/presto

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: debezium/debezium

if (data instanceof java.time.Year) {
  r.deliver(adjustYear(((java.time.Year) data).getValue()));
origin: kiegroup/optaplanner

@Test(expected = IllegalArgumentException.class)
public void remainderOnIncrementTypeExceedsMaximumYear() {
  Year from = Year.of(Year.MIN_VALUE);
  Year to = Year.of(Year.MAX_VALUE - 0);
  assertNotEquals(0, (to.getValue() - from.getValue()) % 10); // Maximum Year range is not divisible by 10
  assertNotNull(new TemporalValueRange<>(from, to, 1, ChronoUnit.DECADES));
}
origin: kiegroup/optaplanner

private void writeTimeGrainDaysHeaders() {
  Day previousTimeGrainDay = null;
  int mergeStart = -1;
  for (TimeGrain timeGrain : solution.getTimeGrainList()) {
    Day timeGrainDay = timeGrain.getDay();
    if (timeGrainDay.equals(previousTimeGrainDay)) {
      nextHeaderCell("");
    } else {
      if (previousTimeGrainDay != null) {
        currentSheet.addMergedRegion(new CellRangeAddress(currentRowNumber, currentRowNumber, mergeStart, currentColumnNumber));
      }
      nextHeaderCell(DAY_FORMATTER.format(
          LocalDate.ofYearDay(Year.now().getValue(), timeGrainDay.getDayOfYear())));
      previousTimeGrainDay = timeGrainDay;
      mergeStart = currentColumnNumber;
    }
  }
  if (previousTimeGrainDay != null) {
    currentSheet.addMergedRegion(new CellRangeAddress(currentRowNumber, currentRowNumber, mergeStart, currentColumnNumber));
  }
}
origin: ebean-orm/ebean

@Override
public void jsonWrite(JsonGenerator writer, Year value) throws IOException {
 writer.writeNumber(value.getValue());
}
origin: kiegroup/optaplanner

private void writeDays() {
  nextSheet("Days", 1, 1, false);
  nextRow();
  nextHeaderCell("Day");
  nextHeaderCell("Start");
  nextHeaderCell("End");
  nextHeaderCell("Lunch hour start time");
  for (Day dayOfYear : solution.getDayList()) {
    nextRow();
    LocalDate date = LocalDate.ofYearDay(Year.now().getValue(), dayOfYear.getDayOfYear());
    int startMinuteOfDay = 24 * 60, endMinuteOfDay = 0;
    for (TimeGrain timeGrain : solution.getTimeGrainList()) {
      if (timeGrain.getDay().equals(dayOfYear)) {
        startMinuteOfDay = timeGrain.getStartingMinuteOfDay() < startMinuteOfDay ?
            timeGrain.getStartingMinuteOfDay() : startMinuteOfDay;
        endMinuteOfDay = timeGrain.getStartingMinuteOfDay() + TimeGrain.GRAIN_LENGTH_IN_MINUTES > endMinuteOfDay ?
            timeGrain.getStartingMinuteOfDay() + TimeGrain.GRAIN_LENGTH_IN_MINUTES : endMinuteOfDay;
      }
    }
    LocalTime startTime = LocalTime.ofSecondOfDay(startMinuteOfDay * 60);
    LocalTime endTime = LocalTime.ofSecondOfDay(endMinuteOfDay * 60);
    LocalTime lunchHourStartTime = LocalTime.ofSecondOfDay(12 * 60 * 60); // 12pm
    nextCell().setCellValue(DAY_FORMATTER.format(date));
    nextCell().setCellValue(TIME_FORMATTER.format(startTime));
    nextCell().setCellValue(TIME_FORMATTER.format(endTime));
    nextCell().setCellValue(TIME_FORMATTER.format(lunchHourStartTime));
  }
  autoSizeColumnsWithHeader();
}
origin: odrotbohm/spring-restbucks

/**
 * Returns the {@link LocalDate} the {@link CreditCard} expires.
 * 
 * @return will never be {@literal null}.
 */
public LocalDate getExpirationDate() {
  return LocalDate.of(expiryYear.getValue(), expiryMonth, 1);
}
origin: org.mybatis/mybatis

@Override
public void setNonNullParameter(PreparedStatement ps, int i, Year year, JdbcType type) throws SQLException {
  ps.setInt(i, year.getValue());
}
origin: ebean-orm/ebean

@Override
public void writeData(DataOutput dataOutput, Year value) throws IOException {
 if (value == null) {
  dataOutput.writeBoolean(false);
 } else {
  dataOutput.writeBoolean(true);
  dataOutput.writeInt(value.getValue());
 }
}
origin: ebean-orm/ebean

@Override
public Object toJdbcType(Object value) {
 if (value instanceof Year) return ((Year) value).getValue();
 return BasicTypeConverter.toInteger(value);
}
origin: pholser/junit-quickcheck

  @Override public Year generate(SourceOfRandomness random, GenerationStatus status) {
    return Year.of(random.nextInt(min.getValue(), max.getValue()));
  }
}
origin: apache/tinkerpop

@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final Year year) {
  output.writeInt(year.getValue());
}
origin: ebean-orm/ebean

@Override
public void bind(DataBind bind, Year value) throws SQLException {
 if (value == null) {
  bind.setNull(Types.INTEGER);
 } else {
  bind.setInt(value.getValue());
 }
}
origin: benas/random-beans

  @Override
  public LocalDate getRandomValue() {
    Year randomYear = yearRandomizer.getRandomValue();
    Month randomMonth = monthRandomizer.getRandomValue();
    int randomDay = dayRandomizer.getRandomValue();
    return LocalDate.of(randomYear.getValue(), randomMonth.getValue(), randomDay);
  }
}
origin: apache/metron

 @SuppressWarnings("rawtypes")
 @Test
 public void testTimestampParsing() throws ParseException {
  JSONObject parsed = parser.parse(fireeyeMessage.getBytes()).get(0);
  JSONParser parser = new JSONParser();
  Map json = (Map) parser.parse(parsed.toJSONString());
  long expectedTimestamp = ZonedDateTime.of(Year.now(ZoneOffset.UTC).getValue(), 3, 19, 5, 24, 39, 0, ZoneOffset.UTC).toInstant().toEpochMilli();
  Assert.assertEquals(expectedTimestamp, json.get("timestamp"));
 }
}
origin: benas/random-beans

  @Override
  public YearMonth getRandomValue() {
    Year randomYear = yearRandomizer.getRandomValue();
    Month randomMonth = monthRandomizer.getRandomValue();
    return YearMonth.of(randomYear.getValue(), randomMonth.getValue());
  }
}
origin: benas/random-beans

  @Override
  public Period getRandomValue() {
    Year randomYear = yearRandomizer.getRandomValue();
    Month randomMonth = monthRandomizer.getRandomValue();
    int randomDay = dayRandomizer.getRandomValue();
    return Period.of(randomYear.getValue(), randomMonth.getValue(), randomDay);
  }
}
origin: apache/metron

@Test
public void testParseOtherLine() throws Exception {
  
  //Set up parser, parse message
  GrokWebSphereParser parser = new GrokWebSphereParser();
  parser.configure(parserConfig);
  String testString = "<134>Apr 15 17:17:34 SAGPXMLQA333 [0x8240001c][audit][info] trans(191): (admin:default:system:*): "
      + "ntp-service 'NTP Service' - Operational state down";
  Optional<MessageParserResult<JSONObject>> resultOptional = parser.parseOptionalResult(testString.getBytes());
  Assert.assertNotNull(resultOptional);
  Assert.assertTrue(resultOptional.isPresent());
  List<JSONObject> result = resultOptional.get().getMessages();
  JSONObject parsedJSON = result.get(0);
  long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 17, 34, 0, UTC).toInstant().toEpochMilli();
  
  //Compare fields
  assertEquals(134, parsedJSON.get("priority"));
  assertEquals(expectedTimestamp, parsedJSON.get("timestamp"));
  assertEquals("SAGPXMLQA333", parsedJSON.get("hostname"));
  assertEquals("0x8240001c", parsedJSON.get("event_code"));
  assertEquals("audit", parsedJSON.get("event_type"));
  assertEquals("info", parsedJSON.get("severity"));
  assertEquals("trans", parsedJSON.get("process"));
  assertEquals("(admin:default:system:*): ntp-service 'NTP Service' - Operational state down", parsedJSON.get("message"));
}

origin: apache/metron

@Test
public void testParseRBMLine() throws Exception {
  
  //Set up parser, parse message
  GrokWebSphereParser parser = new GrokWebSphereParser();
  parser.configure(parserConfig);
  String testString = "<131>Apr 15 17:36:35 ROBXML3QRS [0x80800018][auth][error] rbm(RBM-Settings): "
      + "trans(3502888135)[request] gtid(3502888135): RBM: Resource access denied.";
  Optional<MessageParserResult<JSONObject>> resultOptional = parser.parseOptionalResult(testString.getBytes());
  Assert.assertNotNull(resultOptional);
  Assert.assertTrue(resultOptional.isPresent());
  List<JSONObject> result = resultOptional.get().getMessages();
  JSONObject parsedJSON = result.get(0);
  long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 36, 35, 0, UTC).toInstant().toEpochMilli();
  
  //Compare fields
  assertEquals(131, parsedJSON.get("priority"));
  assertEquals(expectedTimestamp, parsedJSON.get("timestamp"));
  assertEquals("ROBXML3QRS", parsedJSON.get("hostname"));
  assertEquals("0x80800018", parsedJSON.get("event_code"));
  assertEquals("auth", parsedJSON.get("event_type"));
  assertEquals("error", parsedJSON.get("severity"));
  assertEquals("rbm", parsedJSON.get("process"));
  assertEquals("trans(3502888135)[request] gtid(3502888135): RBM: Resource access denied.", parsedJSON.get("message"));
}

java.timeYeargetValue

Javadoc

Gets the year value.

The year returned by this method is proleptic as per get(YEAR).

Popular methods of Year

  • of
    Obtains an instance of Year. This method accepts a year value from the proleptic ISO calendar system
  • parse
    Obtains an instance of Year from a text string using a specific formatter. The text is parsed using
  • now
    Obtains the current year from the system clock in the specified time-zone. This will query the Clock
  • toString
    Outputs this year as a String.
  • atDay
    Combines this year with a day-of-year to create a LocalDate. This returns a LocalDate formed from th
  • from
    Obtains an instance of Year from a temporal object. A TemporalAccessor represents some form of date
  • isLeap
    Checks if the year is a leap year, according to the ISO proleptic calendar system rules. This method
  • atMonthDay
    Combines this year with a month-day to create a LocalDate. This returns a LocalDate formed from this
  • format
    Outputs this year as a String using the formatter. This year will be passed to the formatter DateTim
  • atMonth
    Combines this year with a month to create a YearMonth. This returns a YearMonth formed from this yea
  • compareTo
    Compares this year to another year. The comparison is based on the value of the year. It is "consist
  • plusYears
    Returns a copy of this year with the specified number of years added. This instance is immutable and
  • compareTo,
  • plusYears,
  • getLong,
  • minusYears,
  • plus,
  • <init>,
  • get,
  • length,
  • range

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • BoxLayout (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Join (org.hibernate.mapping)
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now