@AssertTrue(message="{specificDate.isDateTimeValid.AssertTrue}")
private boolean isDateTimeValid() {
try {
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
dateformat.setLenient(false);
ParsePosition position = new ParsePosition(0);
String firstDateTime = this.startDate + " " + this.startTime;
String secondDateTime = this.endDate + " " + this.endTime;
Date first = dateformat.parse(firstDateTime, position);
if (( first == null) || (position.getIndex() != firstDateTime.length()))
return false;
position = new ParsePosition(0);
Date second = dateformat.parse(secondDateTime, position);
if (( second == null) || (position.getIndex() != secondDateTime.length()))
return false;
return first.before(second);
} catch (Exception e) {
BeanValidation.logger.info(e.getMessage());
return false;
}
}
java类javax.validation.constraints.AssertTrue的实例源码
specificDate.java 文件源码
项目:open-Autoscaler
阅读 25
收藏 0
点赞 0
评论 0
AddressDTO.java 文件源码
项目:oma-riista-web
阅读 20
收藏 0
点赞 0
评论 0
@AssertTrue
@JsonIgnore
public boolean isValidAddress() {
return StringUtils.hasText(streetAddress)
&& StringUtils.hasText(postalCode)
&& StringUtils.hasText(city);
}
recurringSchedule.java 文件源码
项目:open-Autoscaler
阅读 24
收藏 0
点赞 0
评论 0
@AssertTrue(message="{recurringSchedule.isRepeatOnValid.AssertTrue}")
private boolean isRepeatOnValid() {
String[] s_values = this.repeatOn.replace("\"", "").replace("[", "").replace("]", "").split(",");
String[] weekday = {"1", "2", "3", "4", "5", "6", "7"};
List<String> weekday_list = Arrays.asList(weekday);
Set<String> validValues = new HashSet<String>(weekday_list);
List<String> value_list = Arrays.asList(s_values);
Set<String> value_set = new HashSet<String>(value_list);
if ( s_values.length > value_set.size()) {
return false;
}
for (String s: s_values){
if(!validValues.contains(s)) {
return false;
}
}
if ( s_values.length > validValues.size()) {
return false;
}
return true;
}
recurringSchedule.java 文件源码
项目:open-Autoscaler
阅读 21
收藏 0
点赞 0
评论 0
@AssertTrue(message="{recurringSchedule.isTimeValid.AssertTrue}")
private boolean isTimeValid() {
try {
SimpleDateFormat parser = new SimpleDateFormat("HH:mm");
parser.setLenient(false);
ParsePosition position = new ParsePosition(0);
Date start_time = parser.parse(this.startTime, position);
if (( start_time == null) || (position.getIndex() != this.startTime.length()))
return false;
position = new ParsePosition(0);
Date end_time = parser.parse(this.endTime, position);
if (( end_time == null) || (position.getIndex() != this.endTime.length()))
return false;
return start_time.before(end_time);
} catch (Exception e) {
return false;
}
}
MinijaxConstraintDescriptor.java 文件源码
项目:minijax
阅读 23
收藏 0
点赞 0
评论 0
private static MinijaxConstraintDescriptor<AssertTrue> buildAssertTrueValidator(final AssertTrue assertTrue, final Class<?> valueClass) {
if (valueClass == boolean.class || valueClass == Boolean.class) {
return new MinijaxConstraintDescriptor<>(assertTrue, AssertTrueValidator.INSTANCE);
}
throw new ValidationException("Unsupported type for @AssertTrue annotation: " + valueClass);
}
AssertTrueAnnotationPostProcessor.java 文件源码
项目:randomito-all
阅读 20
收藏 0
点赞 0
评论 0
@Override
public Object process(AnnotationInfo ctx, Object value) throws Exception {
if (!ctx.isAnnotationPresent(AssertTrue.class)) {
return value;
}
return true;
}
BasicClubHuntingSummary.java 文件源码
项目:oma-riista-web
阅读 24
收藏 0
点赞 0
评论 0
@AssertTrue
public boolean isPresenceOfHarvestCountsConsistentWithModeratorOverride() {
final Object[] harvestCounts = {
numberOfAdultMales, numberOfAdultFemales, numberOfYoungMales, numberOfYoungFemales,
numberOfNonEdibleAdults, numberOfNonEdibleYoungs
};
// When moderator-override flag is true then all harvest count fields must be non-null
// and vice versa.
return moderatorOverride ? F.allNotNull(harvestCounts) : F.allNull(harvestCounts);
}
AbstractChangeConfigurationParams.java 文件源码
项目:steve-plugsurfing
阅读 23
收藏 0
点赞 0
评论 0
@AssertTrue(message = "Custom Configuration Key cannot be left blank")
public boolean isValidCustom() {
if (keyType == ConfigurationKeyType.CUSTOM) {
return !Strings.isNullOrEmpty(customConfKey);
} else {
return true;
}
}
AbstractChangeConfigurationParams.java 文件源码
项目:steve-plugsurfing
阅读 19
收藏 0
点赞 0
评论 0
@AssertTrue(message = "Configuration Key is required")
public boolean isValidPredefined() {
if (keyType == ConfigurationKeyType.PREDEFINED) {
return getPredefinedKey() != null;
} else {
return true;
}
}
StationForm.java 文件源码
项目:steve-plugsurfing
阅读 24
收藏 0
点赞 0
评论 0
@AssertTrue(message = "PlugSurfing requires the number of connectors")
public boolean isValidNumberOfConnections() {
if (plugSurfing) {
return numberOfConnectors != null && numberOfConnectors > 0;
} else {
return true;
}
}
StationForm.java 文件源码
项目:steve-plugsurfing
阅读 22
收藏 0
点赞 0
评论 0
@AssertTrue(message = "PlugSurfing requires latitude and longitude values")
public boolean isLocationEmpty() {
if (plugSurfing) {
return getLocationLatitude() != null && getLocationLongitude() != null;
} else {
return true;
}
}
StationForm.java 文件源码
项目:steve-plugsurfing
阅读 21
收藏 0
点赞 0
评论 0
@AssertTrue(message = "PlugSurfing requires a city")
public boolean isValidCity() {
if (plugSurfing) {
return !Strings.isNullOrEmpty(getAddress().getCity());
} else {
return true;
}
}
GenieTest.java 文件源码
项目:java-di
阅读 24
收藏 0
点赞 0
评论 0
@Test
public void testRegisteredPostConstructProcessor() {
genie.registerPostConstructProcessor(AssertTrue.class, new AssertTrueHandler());
yes(genie.get(FooToPass.class).val);
try {
genie.get(FooToFail.class);
fail("Expect ValidationException here");
} catch (ValidationException e) {
// test pass
}
}
StationForm.java 文件源码
项目:steve-plugsurfing
阅读 21
收藏 0
点赞 0
评论 0
@AssertTrue(message = "PlugSurfing requires a street name")
public boolean isValidStreetName() {
if (plugSurfing) {
return !Strings.isNullOrEmpty(getAddress().getStreet());
} else {
return true;
}
}
StationForm.java 文件源码
项目:steve-plugsurfing
阅读 22
收藏 0
点赞 0
评论 0
@AssertTrue(message = "PlugSurfing requires non-empty phone number")
public boolean isValidPhone() {
if (plugSurfing) {
return !Strings.isNullOrEmpty(getContact().getPhone());
} else {
return true;
}
}
AssertTrueValidationAdapter.java 文件源码
项目:geeMVC-Java-MVC-Framework
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void validate(AssertTrue assertTrueAnnotation, String name, ValidationContext validationCtx, Errors errors) {
Object value = validationCtx.value(name);
boolean isFalse = false;
if (value != null && value instanceof Boolean)
isFalse = Boolean.TRUE.equals(value);
if (!isFalse)
errors.add(name, assertTrueAnnotation.message(), value);
}
ReflectionMagicWorksTest.java 文件源码
项目:backstopper
阅读 24
收藏 0
点赞 0
评论 0
@AssertTrue(message = "I am a constructor annotated with a constraint even though it doesn't really make sense")
public DifferentValidationAnnotationOptions(String nonAnnotatedConstructorParam,
@NotNull(message = "I am a constructor param annotated with a constraint 1") String annotatedConstructorParam1,
@NotNull(message = "I am a constructor param annotated with a constraint 2") String annotatedConstructorParam2,
String alsoNotAnnotatedConstructorParam) {
}
HistoryData.java 文件源码
项目:open-Autoscaler
阅读 20
收藏 0
点赞 0
评论 0
@AssertTrue(message="{HistoryData.isTimeZoneValid.AssertTrue}")
private boolean isTimeZoneValid() {
Set<String> timezoneset = new HashSet<String>(Arrays.asList(Constants.timezones));
if(timezoneset.contains(this.timeZone))
return true;
return false;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 22
收藏 0
点赞 0
评论 0
@AssertTrue(message="{PolicyTrigger.ismetricTypeValid.AssertTrue}")
private boolean isMetricTypeValid() {
for (PolicyTrigger trigger : this.policyTriggers){
if ((trigger.metricType == null) || (!(Arrays.asList(Constants.metrictype).contains(trigger.metricType))))
return false;
}
return true;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 24
收藏 0
点赞 0
评论 0
@AssertTrue(message="{Policy.isMetricTypeValid.AssertTrue}")
private boolean isMetricTypeUnique() {
Set<String> metric_types = new HashSet<String>();
for (PolicyTrigger trigger : this.policyTriggers){
metric_types.add(trigger.metricType);
}
if (metric_types.size() != this.policyTriggers.size())
return false;
else
return true;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 29
收藏 0
点赞 0
评论 0
@AssertTrue(message="{PolicyTrigger.isInstanceStepCountUpValid.AssertTrue}")
private boolean isInstanceStepCountUpValid() { //debug we support count instead of percent change only currently
for (PolicyTrigger trigger : this.policyTriggers){
if (trigger.instanceStepCountUp > (instanceMaxCount -1))
return false;
}
return true;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 25
收藏 0
点赞 0
评论 0
@AssertTrue(message="{PolicyTrigger.isInstanceStepCountDownValid.AssertTrue}")
private boolean isInstanceStepCountDownValid() { //debug we support count instead of percent change only currently
for (PolicyTrigger trigger : this.policyTriggers){
if (trigger.instanceStepCountDown > instanceMaxCount)
return false;
}
return true;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 22
收藏 0
点赞 0
评论 0
@AssertTrue(message="{Policy.isMetricTypeMatched.AssertTrue}")
private boolean isMetricTypeSupported() {
String [] supported_metrics = Constants.getMetricTypeByAppType(this.appType);
BeanValidation.logger.info("supported metrics are: " + Arrays.toString(supported_metrics));
if (supported_metrics != null) {
for (PolicyTrigger trigger : this.policyTriggers) {
if (!(Arrays.asList(supported_metrics).contains(trigger.metricType)))
return false;
}
}
return true;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 20
收藏 0
点赞 0
评论 0
@AssertTrue(message="{Policy.isRecurringScheduleTimeValid.AssertTrue}")
private boolean isRecurringScheduleTimeValid() {
if ((this.schedules != null) && (RecurringScheduleTimeValid(this.schedules.recurringSchedule) == false)) {
return false;
}
return true;
}
TransferedPolicy.java 文件源码
项目:open-Autoscaler
阅读 26
收藏 0
点赞 0
评论 0
@AssertTrue(message="{Policy.isSpecificDateTimeValid.AssertTrue}")
private boolean isSpecificDateTimeValid() {
if ((this.schedules != null) && (SpecificDateTimeValid(this.schedules.specificDate) == false)) {
return false;
}
return true;
}
specificDate.java 文件源码
项目:open-Autoscaler
阅读 24
收藏 0
点赞 0
评论 0
@AssertTrue(message="{specificDate.isInstCountValid.AssertTrue}")
private boolean isInstCountValid() {
if (this.maxInstCount > 0) { //maxInstCount is set
if (this.minInstCount > this.maxInstCount) {
return false;
}
}
return true;
}
recurringSchedule.java 文件源码
项目:open-Autoscaler
阅读 20
收藏 0
点赞 0
评论 0
@AssertTrue(message="{recurringSchedule.isInstCountValid.AssertTrue}")
private boolean isInstCountValid() {
if (this.maxInstCount > 0) { //maxInstCount is set
if (this.minInstCount > this.maxInstCount) {
return false;
}
}
return true;
}
Schedule.java 文件源码
项目:open-Autoscaler
阅读 23
收藏 0
点赞 0
评论 0
@AssertTrue(message="{Schedule.isTimeZoneValid.AssertTrue}") //debug
private boolean isTimeZoneValid() {
if ((null != this.timezone) && (this.timezone.trim().length() != 0)) {
BeanValidation.logger.debug("In schedules timezone is " + this.timezone);//debug
Set<String> timezoneset = new HashSet<String>(Arrays.asList(Constants.timezones));
if(timezoneset.contains(this.timezone))
return true;
else
return false;
}
else {
BeanValidation.logger.debug("timezone is empty in schedules");//debug
return false; //timezone must be specified in Schedule
}
}
Schedule.java 文件源码
项目:open-Autoscaler
阅读 27
收藏 0
点赞 0
评论 0
@AssertTrue(message="{Schedule.isScheduleValid.AssertTrue}") //debug
private boolean isScheduleValid() {
if (((null == this.recurringSchedule) || (this.recurringSchedule.size() == 0) ) && ((null == this.specificDate) || (this.specificDate.size() == 0)) ){
return false; //at least one setting should be exist
}
return true;
}
ChangePass.java 文件源码
项目:Voting_1b
阅读 21
收藏 0
点赞 0
评论 0
@AssertTrue(message = "Las claves no coinciden")
public boolean isClavesCoinciden() {
if (claveNueva != null && confirmacionClave != null) {
return claveNueva.equals(confirmacionClave);
}
return false;
}