public class TimestampPattern extends AnchorBean<TimestampPattern>
A regular-expression specifies whether the file-name matches, and respective groups for year, month, day, hour, minutes, seconds.
Constructor and Description |
---|
TimestampPattern() |
TimestampPattern(String regularExpression) |
Modifier and Type | Method and Description |
---|---|
int |
getIndexDay()
The index of the group in
regularExpression that encodes the day, starting
from 0 for the first group. |
int |
getIndexHours()
The index of the group in
regularExpression that encodes the hours, starting
from 0 for the first group. |
int |
getIndexMinutes()
The index of the group in
regularExpression that encodes the minutes, starting
from 0 for the first group. |
int |
getIndexMonth()
The index of the group in
regularExpression that encodes the month, starting
from 0 for the first group. |
int |
getIndexSeconds()
The index of the group in
regularExpression that encodes the seconds, starting
from 0 for the first group. |
int |
getIndexYear()
The index of the group in
regularExpression that encodes the year, starting
from 0 for the first group. |
String |
getRegularExpression()
The regular-expression that checks a match and specifies groups for the encoded date-time.
|
Optional<Long> |
match(String fileName,
java.time.ZoneOffset offset)
Matches certain times.
|
void |
setIndexDay(int indexDay)
The index of the group in
regularExpression that encodes the day, starting
from 0 for the first group. |
void |
setIndexHours(int indexHours)
The index of the group in
regularExpression that encodes the hours, starting
from 0 for the first group. |
void |
setIndexMinutes(int indexMinutes)
The index of the group in
regularExpression that encodes the minutes, starting
from 0 for the first group. |
void |
setIndexMonth(int indexMonth)
The index of the group in
regularExpression that encodes the month, starting
from 0 for the first group. |
void |
setIndexSeconds(int indexSeconds)
The index of the group in
regularExpression that encodes the seconds, starting
from 0 for the first group. |
void |
setIndexYear(int indexYear)
The index of the group in
regularExpression that encodes the year, starting
from 0 for the first group. |
void |
setRegularExpression(String regularExpression)
The regular-expression that checks a match and specifies groups for the encoded date-time.
|
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public TimestampPattern(String regularExpression)
public TimestampPattern()
public Optional<Long> match(String fileName, java.time.ZoneOffset offset)
fileName
- the fileName to try and match against the pattern.offset
- the offset to assume the time-stamp belongs in.public String getRegularExpression()
public void setRegularExpression(String regularExpression)
public int getIndexYear()
regularExpression
that encodes the year, starting
from 0 for the first group.public void setIndexYear(int indexYear)
regularExpression
that encodes the year, starting
from 0 for the first group.public int getIndexMonth()
regularExpression
that encodes the month, starting
from 0 for the first group.public void setIndexMonth(int indexMonth)
regularExpression
that encodes the month, starting
from 0 for the first group.public int getIndexDay()
regularExpression
that encodes the day, starting
from 0 for the first group.public void setIndexDay(int indexDay)
regularExpression
that encodes the day, starting
from 0 for the first group.public int getIndexHours()
regularExpression
that encodes the hours, starting
from 0 for the first group.public void setIndexHours(int indexHours)
regularExpression
that encodes the hours, starting
from 0 for the first group.public int getIndexMinutes()
regularExpression
that encodes the minutes, starting
from 0 for the first group.public void setIndexMinutes(int indexMinutes)
regularExpression
that encodes the minutes, starting
from 0 for the first group.public int getIndexSeconds()
regularExpression
that encodes the seconds, starting
from 0 for the first group.public void setIndexSeconds(int indexSeconds)
regularExpression
that encodes the seconds, starting
from 0 for the first group.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.