
com.liferay.search.experiences.internal.blueprint.parameter.DateSXPParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.search.experiences.service
Show all versions of com.liferay.search.experiences.service
Liferay Search Experiences Service
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.search.experiences.internal.blueprint.parameter;
import com.liferay.petra.reflect.ReflectionUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.Validator;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
/**
* @author Petteri Karttunen
*/
public class DateSXPParameter extends BaseSXPParameter {
public DateSXPParameter(String name, boolean templateVariable, Date value) {
super(name, templateVariable);
_value = value;
}
@Override
public boolean evaluateEquals(String format, Object object) {
DateFormat dateFormat = new SimpleDateFormat(format);
return Objects.equals(
dateFormat.format(_value), GetterUtil.getString(object));
}
@Override
public boolean evaluateRange(
String format, Object gt, Object gte, Object lt, Object lte) {
DateFormat dateFormat = new SimpleDateFormat(format);
Date value = _parse(dateFormat, dateFormat.format(_value));
Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy