}
/**
- * Get created date formated into a String.
+ * Get created date formatted into a String.
*
* @return A string representation of the created date.
*/
}
/**
- * Get last printed date formated into a String.
+ * Get last printed date formatted into a String.
*
* @return A string representation of the last printed date.
*/
}
/**
- * Get modified date formated into a String.
+ * Get modified date formatted into a String.
*
* @return A string representation of the modified date.
*/
*/
@Override
public void setCategoryProperty(String category) {
- this.category = setStringValue(category);
+ this.category = parseStringValue(category);
}
/**
*/
@Override
public void setContentStatusProperty(String contentStatus) {
- this.contentStatus = setStringValue(contentStatus);
+ this.contentStatus = parseStringValue(contentStatus);
}
/**
*/
@Override
public void setContentTypeProperty(String contentType) {
- this.contentType = setStringValue(contentType);
+ this.contentType = parseStringValue(contentType);
}
/**
*/
@Override
public void setCreatedProperty(String created) {
- if (created != null) {
- try {
- this.created = setDateValue(created);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("Date for created could not be parsed: " + created, e);
- }
+ try {
+ this.created = parseDateValue(created);
+ } catch (InvalidFormatException e) {
+ throw new IllegalArgumentException("Date for created could not be parsed: " + created, e);
}
}
*/
@Override
public void setCreatedProperty(Optional<Date> created) {
- if (created.isPresent())
- this.created = created;
+ this.created = created;
}
/**
*/
@Override
public void setCreatorProperty(String creator) {
- this.creator = setStringValue(creator);
+ this.creator = parseStringValue(creator);
}
/**
*/
@Override
public void setDescriptionProperty(String description) {
- this.description = setStringValue(description);
+ this.description = parseStringValue(description);
}
/**
*/
@Override
public void setIdentifierProperty(String identifier) {
- this.identifier = setStringValue(identifier);
+ this.identifier = parseStringValue(identifier);
}
/**
*/
@Override
public void setKeywordsProperty(String keywords) {
- this.keywords = setStringValue(keywords);
+ this.keywords = parseStringValue(keywords);
}
/**
*/
@Override
public void setLanguageProperty(String language) {
- this.language = setStringValue(language);
+ this.language = parseStringValue(language);
}
/**
*/
@Override
public void setLastModifiedByProperty(String lastModifiedBy) {
- this.lastModifiedBy = setStringValue(lastModifiedBy);
+ this.lastModifiedBy = parseStringValue(lastModifiedBy);
}
/**
*/
@Override
public void setLastPrintedProperty(String lastPrinted) {
- if (lastPrinted != null) {
- try {
- this.lastPrinted = setDateValue(lastPrinted);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("lastPrinted : "
- + e.getLocalizedMessage(), e);
- }
+ try {
+ this.lastPrinted = parseDateValue(lastPrinted);
+ } catch (InvalidFormatException e) {
+ throw new IllegalArgumentException("lastPrinted : "
+ + e.getLocalizedMessage(), e);
}
}
*/
@Override
public void setLastPrintedProperty(Optional<Date> lastPrinted) {
- if (lastPrinted.isPresent())
- this.lastPrinted = lastPrinted;
+ this.lastPrinted = lastPrinted;
}
/**
*/
@Override
public void setModifiedProperty(String modified) {
- if (modified != null) {
- try {
- this.modified = setDateValue(modified);
- } catch (InvalidFormatException e) {
- throw new IllegalArgumentException("modified : "
- + e.getLocalizedMessage(), e);
- }
+ try {
+ this.modified = parseDateValue(modified);
+ } catch (InvalidFormatException e) {
+ throw new IllegalArgumentException("modified : "
+ + e.getLocalizedMessage(), e);
}
}
*/
@Override
public void setModifiedProperty(Optional<Date> modified) {
- if (modified.isPresent())
- this.modified = modified;
+ this.modified = modified;
}
/**
*/
@Override
public void setRevisionProperty(String revision) {
- this.revision = setStringValue(revision);
+ this.revision = parseStringValue(revision);
}
/**
* Set subject.
*/
@Override
public void setSubjectProperty(String subject) {
- this.subject = setStringValue(subject);
+ this.subject = parseStringValue(subject);
}
/**
*/
@Override
public void setTitleProperty(String title) {
- this.title = setStringValue(title);
+ this.title = parseStringValue(title);
}
/**
*/
@Override
public void setVersionProperty(String version) {
- this.version = setStringValue(version);
+ this.version = parseStringValue(version);
}
/**
/**
* Convert a string value into a {@code Optional<String>}
*/
- private Optional<String> setStringValue(String s) {
+ private Optional<String> parseStringValue(String s) {
if (s == null || s.isEmpty()) {
return Optional.empty();
}
* @throws InvalidFormatException
* Throws if the date format is not valid.
*/
- private Optional<Date> setDateValue(String dateStr) throws InvalidFormatException {
+ private Optional<Date> parseDateValue(String dateStr) throws InvalidFormatException {
if (dateStr == null || dateStr.isEmpty()) {
return Optional.empty();
}
*
* @param d
* The Date to convert.
- * @return The formated date or null.
+ * @return The formatted date or null.
* @see java.text.SimpleDateFormat
*/
private static String getDateValue(Optional<Date> d) {