#JsonFormat not working in nested object - java

I have a very simple bean:
public class StatusBean {
private String name;
#JsonFormat(shape=JsonFormat.Shape.STRING, pattern="MM-dd-yyyy")
private Date startDate;
#JsonFormat(shape=JsonFormat.Shape.STRING, pattern="MM-dd-yyyy")
private Date endDate;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
And I wrap it in another bean that I use to wrap objects for nice json formatting with messages and stuff:
public class ResponseBean {
private boolean success = false;
private String message;
private Object data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
In my controller, I set the Status bean inside the response bean with a setData();
Spring serializes this out in JSON format, however the output for the date is not formatting. I am getting the standard "yyyy-MM-DD" format.
Am I doing something wrong? How do I get this to work?

I had the same issue and fixed simply adding #JsonSerialize(as = Date.class) before #JsonFormat(shape=JsonFormat.Shape.STRING, pattern="MM-dd-yyyy")

With #DateTimeFormat(pattern="dd/MM/yyyy") from
org.springframework.format.annotation.DateTimeFormat worked for me.

I have never tried it but the solution could be to add this annotation in your ResponseBean:
#JsonSerialize(as = StatusBean.class)
private Object data;
unfortunately your Object will become a StatusBean

Possibility not write object with ObjectMapper
new ObjectMapper().writeValueAsString(MyObject);
Full code example
public static void main(String[] args) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
System.out.println(objectMapper.writeValueAsString(new Foo(new java.util.Date())));
System.out.println(objectMapper.writeValueAsString(new Foo(new java.sql.Date(System.currentTimeMillis()))));
}
static class Foo {
#JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy", timezone="EST")
private Date birthdate;
public Foo() {
}
public Foo(Date birthdate) {
this.birthdate = birthdate;
}
public Date getBirthdate() {
return birthdate;
}
}

Related

i have created a custom class which can get date and time as strings i want to access the object and set data to the class any suggestions

i have created a custom class which can get date and time as strings i want to access the object and set data to the class any suggestions
here is my code
public class DateTime {
private String Date;
private String Time;
public DateTime(String Date,String Time) {
this.Date=Date;
this.Time=Time;
}
public void showDateAndTime() {
System.out.println("entery Date is :");
System.out.println(Date);
System.out.println("entery time is :");
System.out.println(Time);
}
}
public class Vehicle {
public int ID;
public String Brand;
public String type;
public DateTime entryTimeDate;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Vehicle v1=new Vehicle();
v1.entryTimeDate**********
}
i want to set date time value to v1 object any suggestions?
Instead of having public fields in Vehicle class, make them private and then use accessor and mutator methods in order to gain access to them. Then vehicle.getEntryTimeDate() will be enough to give you the DateTime object of the vehicle. With other words:
public class Vehicle {
private int id;
public String brand;
public String type;
public DateTime entryTimeDate;
public Vehicle()
{
setId(0);
setBrand("");
setType("");
setEntryTimeDate(new DateTime("DATE", "TIME"));
}
public Vehicle(int id, String brand, String type, DateTime entryTimeDate) {
this.id = id;
this.brand = brand;
this.type = type;
this.entryTimeDate = entryTimeDate;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public DateTime getEntryTimeDate() {
return entryTimeDate;
}
public void setEntryTimeDate(DateTime entryTimeDate) {
this.entryTimeDate = entryTimeDate;
}
public static class DateTime{
private String date;
private String time;
public DateTime(String date,String time) {
this.setDate(date);
this.setTime(time);
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
public static void main(String[] args) {
Vehicle v1 = new Vehicle();
v1.getEntryTimeDate().setTime("Time of the vehicle");
v1.getEntryTimeDate().setDate("Date of the vehicle.");
}
}
Some notes: Ignore the static keyword in DateTime class. I did it in order to create an SSCCE. Also notice the field naming convention i followed (camel-case). It is the most used naming convention by Java programmers.

error: incompatible types: int cannot be converted to Client - Java

I'm fairly new to Java and am working on a Spring Boot database application (MySQL) in which I am trying to create a method which will allow for a Client (Java object) to be deleted from my database using a Dao/CrudRepository and searching by the unique Id. I am receiving an error when running stating "error: incompatible types: int cannot be converted to Client"
I've compared to a similar program created in which I used the same syntax with no issue, so unsure why I am getting this error when processing.
My object is set up like so:
#Entity
public class Client {
#Id
#GeneratedValue
private int id;
#NotNull
#Size(min=1, message = "Must enter client name")
private String name;
#NotNull
#Size(min=1, message= "Must enter contact's name")
private String contact;
#NotNull
#Size(min=1, message="Must enter primary office location")
private String location;
#NotNull(message="Must enter contract start date")
private String startDate;
#NotNull(message="Must enter contract end date")
private String endDate;
#NotNull(message="Must enter employee count")
private Integer employeeCount;
private PhilanthropyInterest interest;
public Client(String name, String contact, String location, String startDate, String endDate, Integer employeeCount) {
this.name = name;
this.contact = contact;
this.location = location;
this.startDate = startDate;
this.endDate = endDate;
this.employeeCount = employeeCount;
}
public Client () { }
public int getId() { return id; }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public Integer getEmployeeCount() {
return employeeCount;
}
public void setEmployeeCount(Integer employeeCount) {
this.employeeCount = employeeCount;
}
public PhilanthropyInterest getInterest() { return interest; }
public void setInterest(PhilanthropyInterest interest) { this.interest = interest; }
And my controller method in which I am receiving the error is:
#RequestMapping(value = "remove", method = RequestMethod.GET)
public String displayRemoveAddClientForm(Model model) {
model.addAttribute("clients", clientDao.findAll());
model.addAttribute("title", "Remove Client");
return "clients/remove";
}
#RequestMapping(value = "remove", method = RequestMethod.POST)
public String processRemoveClientForm(#RequestParam int[] clientIds) {
for (int clientId : clientIds) {
clientDao.delete(clientId);
}
return "redirect:";
}
And my ClientDao class is:
#Repository
#Transactional
public interface ClientDao extends CrudRepository<Client, Integer> {
}
The error showing in IntelliJ states:
delete
(org.launchcode.spcdb.models.Client)
in CrudRepository cannot be applied
to
(int)
and when running, I am receiving:
error: incompatible types: int cannot be converted to Client
clientDao.delete(clientId);
here you can find the documentation for CRUDRepository : https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/CrudRepository.html
You will see that the method delete(T entity) method take an Object as argument.
In your case, it is a Client.
As you are using
public interface ClientDao extends CrudRepository<Client, Integer>
the method delete(T entity) that you use is expecting an Client.
So try :
public String processRemoveClientForm(#RequestParam int[] clientIds) {
List<Client> clientList = clientDAO.findByIds(clientIds);
for (Client client : clientList) {
clientDao.delete(client );
}
}
this should work. Nerver forget that you are manipulating Object in this case.

mongodb auditing in spring boot for saving createdDate, lastModifiedDate, createdBy, lastModifiedBy

I am using spring boot, therefore I am not using any xml files for configurations.
What I have to do is to EnableMongoAuditing for saving createdDate, lastModifiedDate etc while saving data using MongoRepositories.
My model class
#Component
#Document(collection = "CAPPING")
public class TemporaryCapping extends BaseEntity {
#Field("contract_id")
private BigInteger contractId;
#Field("period_id")
private BigInteger periodId;
#Field("user_id")
private BigInteger userId;
#Field("amount")
private Double amount;
#Field("type_of_capping")
private TypeOfCapping typeOfCapping;
public BigInteger getContractId() {
return contractId;
}
public void setContractId(BigInteger contractId) {
this.contractId = contractId;
}
public BigInteger getPeriodId() {
return periodId;
}
public void setPeriodId(BigInteger periodId) {
this.periodId = periodId;
}
public BigInteger getUserId() {
return userId;
}
public void setUserId(BigInteger userId) {
this.userId = userId;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public TypeOfCapping getTypeOfCapping() {
return typeOfCapping;
}
public void setTypeOfCapping(TypeOfCapping typeOfCapping) {
this.typeOfCapping = typeOfCapping;
}
}
public class BaseEntity implements Serializable{
#Id
#Indexed(unique = true)
private BigInteger id;
#CreatedDate
private DateTime createdDate;
#Field("modified_date")
private BigInteger modifiedDate;
public BigInteger getId() {
return id;
}
public void setId(BigInteger id) {
this.id = id;
}
public DateTime getCreatedDate() {
return createdDate;
}
public void setCreatedDate(DateTime createdDate) {
this.createdDate = createdDate;
}
public BigInteger getModifiedDate() {
return modifiedDate;
}
public void setModifiedDate(BigInteger modifiedDate) {
this.modifiedDate = modifiedDate;
}
I have used #CreateDate annotation for saving createDate.
and I have used jodatime dependency for DateTime
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.7</version>
</dependency>
spring-data-mongodb is also added in the dependencies.
This is my main application class
#SpringBootApplication
#EnableMongoAuditing
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Where I am wrong in this impelmentation as the date is not getting saved in database?
Also I know that for saving #createdBy you need to write AuditorAware bean but for now I am just trying to save createdBy.
Where should #EnableMongoAuditing be used?
In my application I configure through Java code. I use #EnableMongAuditing this way and also create convertes for ZonedDateTime.
#Configuration
#EnableMongoAuditing
#EnableMongoRepositories(basePackages = { BASE_PACKAGE })
public class MongoConfiguration extends AbstractMongoConfiguration {
public static final String BASE_PACKAGE = "package.with.aggregates";
#Value("${spring.data.mongodb.uri}")
private String mongoUri;
#Value("${spring.data.mongodb.database}")
private String databaseName;
#Override
protected String getDatabaseName() {
return databaseName;
}
#Override
public Mongo mongo() throws Exception {
return new MongoClient(new MongoClientURI(mongoUri));
}
// Here you must add converters to Joda datetypes. In my solution is ZonedDateTime
#Override
public CustomConversions customConversions() {
List<Converter<?, ?>> converterList = new ArrayList<>();
converterList.add(new DateToZonedDateTimeConverter());
converterList.add(new ZonedDateTimeToDateConverter());
return new CustomConversions(converterList);
}
#Override
protected String getMappingBasePackage() {
return BASE_PACKAGE;
}
}
#EnableMongoAuditing can actually be placed anywhere in configurations (next to #Configuration annotation)

ObjectMapper SetDateFormat() is not working

I have used ObjectMapper to map a object to Json String.
I have date Fields in the object to format the date i have used the below code but it is not formatting as expected.
My Json String:
{"leaveRequestId":51,"reason":"xdvfsgf","leaveFromDate":"2016-07-13","leaveToDate":"2016-07-15","leaveTypeId":9,"statusId":1,"instanceId":"7527","createdBy":"pramod","createdOn":"2016-07-07","modifiedBy":null,"modifiedOn":null}
I am using the below code:
#RequestMapping(value="/getLeaveRequest", method = RequestMethod.GET)
#ResponseBody
public String getLeaveRequest( int leaveRequestId) throws Exception {
DAOFactory obj_daofactory=new DAOFactory();
ObjectMapper mapper = new ObjectMapper();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MMM-dd");
mapper.setDateFormat(df);
LeaveRequest leaveRequest = obj_daofactory.getLeaveRequestDao().findByLeaveRequestId(leaveRequestId);
if(leaveRequest.getLeaveRequestId() == 0){
return "No data found";
} else {
System.out.println(leaveRequest.getLeaveFromDate().toString());
String jsonInString = mapper.writeValueAsString(leaveRequest);
System.out.println(jsonInString);
return jsonInString;
}
}
MY Expected OutPut:
{"leaveRequestId":45,"reason":"test","leaveFromDate":"2016-Jul-07","leaveToDate":"2016-Jul-08","leaveTypeId":9,"statusId":1,"instanceId":"test1","createdBy":"deepak.paul#muraai.com","createdOn":"2016-Jul-07","modifiedBy":"pramod","modifiedOn":"2016-Jul-08"}
Date must be in the "2016-Jul-07" format
LeaveRequest.java
import java.util.Date;
public class LeaveRequest {
private int leaveRequestId;
private String reason;
private Date leaveFromDate;
private Date leaveToDate;
private int leaveTypeId;
private int statusId;
private String instanceId;
private String createdBy;
private Date createdOn;
private String modifiedBy;
private Date modifiedOn;
public LeaveRequest() {
}
public LeaveRequest(int leaveRequestId, String reason, Date leaveFromDate, Date leaveToDate,int leaveTypeId,int statusId, String instanceId,
String createdBy, Date createdOn, String modifiedBy, Date modifiedOn) {
this.leaveRequestId=leaveRequestId;
this.reason=reason;
this.leaveFromDate=leaveFromDate;
this.leaveToDate=leaveToDate;
this.leaveTypeId=leaveTypeId;
this.statusId=statusId;
this.instanceId=instanceId;
this.createdBy=createdBy;
this.createdOn=createdOn;
this.modifiedBy=modifiedBy;
this.modifiedOn=modifiedOn;
}
public LeaveRequest(String reason, Date leaveFromDate, Date leaveToDate,int leaveTypeId,int statusId, String instanceId,
String createdBy, Date createdOn) {
this.reason=reason;
this.leaveFromDate=leaveFromDate;
this.leaveToDate=leaveToDate;
this.leaveToDate=leaveToDate;
this.leaveTypeId=leaveTypeId;
this.statusId=statusId;
this.instanceId=instanceId;
this.createdBy=createdBy;
this.createdOn=createdOn;
}
public int getLeaveRequestId() {
return leaveRequestId;
}
public void setLeaveRequestId(int leaveRequestId) {
this.leaveRequestId = leaveRequestId;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Date getLeaveToDate() {
return leaveToDate;
}
public void setLeaveToDate(Date leaveToDate) {
this.leaveToDate = leaveToDate;
}
public Date getLeaveFromDate() {
return leaveFromDate;
}
public void setLeaveFromDate(Date leaveFromDate) {
this.leaveFromDate = leaveFromDate;
}
public int getStatusId() {
return statusId;
}
public void setStatusId(int statusId) {
this.statusId = statusId;
}
public int getLeaveTypeId() {
return leaveTypeId;
}
public void setLeaveTypeId(int leaveTypeId) {
this.leaveTypeId = leaveTypeId;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
public Date getModifiedOn() {
return modifiedOn;
}
public void setModifiedOn(Date modifiedOn) {
this.modifiedOn = modifiedOn;
}
public String getInstanceId() {
return instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
}
As you said you input is 2016-07-13 which is yyyy-MM-dd format. You have to read it using yyyy-MM-dd and while writing use yyyy-MMM-dd
ObjectMapper mapper = new ObjectMapper();
try {
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
LeaveRequest lrq = mapper.readValue("{\"leaveRequestId\":51,\"reason\":\"xdvfsgf\",\"leaveFromDate\":\"2016-07-13\",\"leaveToDate\":\"2016-07-15\",\"leaveTypeId\":9,\"statusId\":1,\"instanceId\":\"7527\",\"createdBy\":\"pramod\",\"createdOn\":\"2016-07-07\",\"modifiedBy\":null,\"modifiedOn\":null}", LeaveRequest.class);
System.out.println(mapper.setDateFormat(new SimpleDateFormat("yyyy-MMM-dd")).writeValueAsString(lrq));
} catch (IOException ex) {
Logger.getLogger(NewClass1.class.getName()).log(Level.SEVERE, null, ex);
}
I wrote this code to convert date to "yyyy-MM-dd" which ideally should have worked but it didn't
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setTimeZone(TimeZone.getDefault());
ObjectMapper mapper = new ObjectMapper();
mapper.setDateFormat(dateFormat);
myObj =objectMapper.readValue(file,MyObj.class)
Output was coming as - "paymentDate": "2019-08-18T23:00:00.000+0000", which isnt what I was expecting..
Changed this to Declaring ObjectMapper as a Bean and then inject ObjectMapper as a dependency
//Make sure the class is annotated with #Configuration or appropriate
#Bean
public ObjectMapper objectMapper() {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setTimeZone(TimeZone.getDefault());
ObjectMapper mapper = new ObjectMapper();
mapper.setDateFormat(dateFormat);
return mapper;
}
and in-service class, just inject this as a dependency
#Autowired
private ObjectMapper objectMapper;
somemethod(){
myObj =objectMapper.readValue(file,MyObj.class)
}
Output was coming as -"paymentDate": "2019-08-19" -as expected
Serialization and deserialization will have to come into picture when you manipulate/modify the contents as per your requirement through ObjectMapper. You can refer more about this here
This topic has also been discussed here.

Interface's implementations MUST implement its inner class builder interface. How to do it?

I have an interesting question.
I have created an interface as so; the idea is that a class which implements this interface will have to implement the TimeRangeBuilder too
import java.util.Date;
public interface TimeRange<T> extends Comparable<T> {
public static interface TimeRangeBuilder<T> {
public TimeRangeBuilder<T> startDate(Date startDate);
public TimeRangeBuilder<T> endDate(Date endDate);
public T build();
}
public Date getStartDate();
public Date getEndDate();
}
But unfortunately this isn't how it works; when I implement this interface in a concrete class; the implementation of the TimeRangeBuilder is completely optional.
To give you an idea of where I'm heading, here is my implementation class
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import ru.crystals.videoutil.utils.TimeRange;
public class VidArchive implements TimeRange<VidArchive> {
/** date format used to convert Date objects to human-readable form for the toString() function */
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss");
private final byte[] bytes;
private final String cam;
private final Date startDate;
private final Date endDate;
private final String fileName;
private final String directory;
public static class Builder implements TimeRangeBuilder<VidArchive> {
private byte[] bytes;
private String cam;
private Date startDate;
private Date endDate;
private String fileName;
private String directory;
public Builder() {}
public Builder bytes(byte[] bytes) { this.bytes = bytes; return this; }
public Builder cam(String cam) { this.cam = cam; return this; }
#Override
public Builder startDate(Date startDate) { this.startDate = startDate; return this; }
#Override
public Builder endDate(Date endDate) { this.endDate = endDate; return this; }
public Builder fileName(String fileName) { this.fileName = fileName; return this; }
public Builder directory(String directory) { this.directory = directory; return this; }
#Override
public VidArchive build() { return new VidArchive(this); }
}
private VidArchive(Builder builder) {
bytes = builder.bytes;
cam = builder.cam;
startDate = builder.startDate;
endDate = builder.endDate;
fileName = builder.fileName;
directory = builder.directory;
}
public byte[] getBytes() { return bytes; }
public String getCam() { return cam; }
#Override
public Date getStartDate() { return startDate; }
#Override
public Date getEndDate() { return endDate; }
public String getFileName() { return fileName; }
public String getDirectory() { return directory; }
#Override
public int compareTo(VidArchive vidArchive) {
return startDate.compareTo(vidArchive.getStartDate());
}
#Override
public String toString() {
return DATE_FORMAT.format(startDate) + " - " + DATE_FORMAT.format(endDate);
}
}
And it all comes down to this; I have another class that should compatible not only with the VidArchive class, but all implementations of the TimeRange interface. Here is the code that I want to get working
public class TimeBar<E extends TimeRange<E>> extends JProgressBar {
private TreeSet<E> timeRanges;
...
...
public void seekToTime() {
/** create a dummy object (an implementation of the TimeRange interface) with the most recent date set in TimeBarUI, so that it can be compared
* to all the other objects in the set in order to find the closest one by time*/
E archive = new E.Builder().
startDate(((TimeBarUI)ui).getMostRecentDate()).
endDate(((TimeBarUI)ui).getMostRecentDate()).
build();
TimeRange<E> closest = timeRanges.headSet(archive, true).last();
...
}
}
As you gentlemen can imagine; that whole E.Builder() thing.. yep, it doesn't work.
Help me to get it to work, or find an alternative solution to my conundrum (I would be open to an alternative Builder implementation, but I would very much like to keep my Builder.
P.S. Any other suggestions in regards to my code would be welcome too. I'm always eager to improve.
I am not sure to understand but is it what you try to achieve ?
import java.util.Date;
public interface TimeRange<T,K> extends Comparable<T> {
public K Builder();
public static interface TimeRangeBuilder<T> {
public TimeRangeBuilder<T> startDate(Date startDate);
public TimeRangeBuilder<T> endDate(Date endDate);
public T build();
}
public Date getStartDate();
public Date getEndDate();
}
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class VidArchive implements TimeRange<VidArchive, VidArchive.Builder> {
/** date format used to convert Date objects to human-readable form for the toString() function */
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss");
private final byte[] bytes;
private final String cam;
private final Date startDate;
private final Date endDate;
private final String fileName;
private final String directory;
private Builder builder;
#Override
public Builder Builder() {
return builder;
}
public static class Builder implements TimeRangeBuilder<VidArchive> {
private byte[] bytes;
private String cam;
private Date startDate;
private Date endDate;
private String fileName;
private String directory;
public Builder() {}
public Builder bytes(byte[] bytes) { this.bytes = bytes; return this; }
public Builder cam(String cam) { this.cam = cam; return this; }
#Override
public Builder startDate(Date startDate) { this.startDate = startDate; return this; }
#Override
public Builder endDate(Date endDate) { this.endDate = endDate; return this; }
public Builder fileName(String fileName) { this.fileName = fileName; return this; }
public Builder directory(String directory) { this.directory = directory; return this; }
#Override
public VidArchive build() { return new VidArchive(this); }
}
private VidArchive(Builder builder) {
this.builder = builder;
bytes = builder.bytes;
cam = builder.cam;
startDate = builder.startDate;
endDate = builder.endDate;
fileName = builder.fileName;
directory = builder.directory;
}
public byte[] getBytes() { return bytes; }
public String getCam() { return cam; }
#Override
public Date getStartDate() { return startDate; }
#Override
public Date getEndDate() { return endDate; }
public String getFileName() { return fileName; }
public String getDirectory() { return directory; }
#Override
public int compareTo(VidArchive vidArchive) {
return startDate.compareTo(vidArchive.getStartDate());
}
#Override
public String toString() {
return DATE_FORMAT.format(startDate) + " - " + DATE_FORMAT.format(endDate);
}
}

Categories

Resources