Codota Logo
HibernateConstraintValidatorContext.getTimeProvider
Code IndexAdd Codota to your IDE (free)

How to use
getTimeProvider
method
in
org.hibernate.validator.constraintvalidation.HibernateConstraintValidatorContext

Best Java code snippets using org.hibernate.validator.constraintvalidation.HibernateConstraintValidatorContext.getTimeProvider (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(Calendar cal, ConstraintValidatorContext context) {
    //null values are valid
    if ( cal == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return cal.getTimeInMillis() > now;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(Calendar cal, ConstraintValidatorContext constraintValidatorContext) {
    //null values are valid
    if ( cal == null ) {
      return true;
    }

    TimeProvider timeProvider = constraintValidatorContext.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return cal.getTimeInMillis() < now;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(Date date, ConstraintValidatorContext constraintValidatorContext) {
    //null values are valid
    if ( date == null ) {
      return true;
    }

    TimeProvider timeProvider = constraintValidatorContext.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return date.getTime() > now;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(Date date, ConstraintValidatorContext constraintValidatorContext) {
    //null values are valid
    if ( date == null ) {
      return true;
    }

    TimeProvider timeProvider = constraintValidatorContext.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return date.getTime() < now;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(Instant value, ConstraintValidatorContext context) {
    // null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    Instant reference = Instant.ofEpochMilli( timeProvider.getCurrentTime() );

    return value.compareTo( reference ) > 0;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(Instant value, ConstraintValidatorContext context) {
    // null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    Instant reference = Instant.ofEpochMilli( timeProvider.getCurrentTime() );

    return value.compareTo( reference ) < 0;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(ChronoZonedDateTime<?> value, ConstraintValidatorContext context) {
    // null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    ZonedDateTime reference = ZonedDateTime.ofInstant( Instant.ofEpochMilli( timeProvider.getCurrentTime() ), value.getZone() );

    return value.compareTo( reference ) > 0;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(ChronoZonedDateTime<?> value, ConstraintValidatorContext context) {
    // null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    ZonedDateTime reference = ZonedDateTime.ofInstant( Instant.ofEpochMilli( timeProvider.getCurrentTime() ), value.getZone() );

    return value.compareTo( reference ) < 0;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(ReadablePartial value, ConstraintValidatorContext context) {
    //null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return value.toDateTime( new Instant( now ) ).isAfter( now );
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(ReadableInstant value, ConstraintValidatorContext context) {
    //null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return value.getMillis() < now;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(ReadablePartial value, ConstraintValidatorContext context) {
    //null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return value.toDateTime( new Instant( now ) ).isBefore( now );
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(ReadableInstant value, ConstraintValidatorContext context) {
    //null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    long now = timeProvider.getCurrentTime();

    return value.getMillis() > now;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(OffsetDateTime value, ConstraintValidatorContext context) {
    // null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    OffsetDateTime reference = OffsetDateTime.ofInstant( Instant.ofEpochMilli( timeProvider.getCurrentTime() ), value.getOffset() );

    return value.compareTo( reference ) < 0;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator

  @Override
  public boolean isValid(OffsetDateTime value, ConstraintValidatorContext context) {
    // null values are valid
    if ( value == null ) {
      return true;
    }

    TimeProvider timeProvider = context.unwrap( HibernateConstraintValidatorContext.class )
        .getTimeProvider();
    OffsetDateTime reference = OffsetDateTime.ofInstant( Instant.ofEpochMilli( timeProvider.getCurrentTime() ), value.getOffset() );

    return value.compareTo( reference ) > 0;
  }
}
org.hibernate.validator.constraintvalidationHibernateConstraintValidatorContextgetTimeProvider

Javadoc

Returns the provider for obtaining the current time, e.g. when validating the Future and Pastconstraints.

Popular methods of HibernateConstraintValidatorContext

  • addExpressionVariable
    Allows to set an additional expression variable which will be available as an EL variable during int
  • withDynamicPayload
    Allows to set an object that may further describe the violation. The user is responsible himself to
  • buildConstraintViolationWithTemplate
  • getConstraintValidatorPayload
    Returns an instance of the specified type or null if the current constraint validator payload isn't
  • addMessageParameter
    Allows to set an additional named parameter which can be interpolated in the constraint violation me
  • disableDefaultConstraintViolation
  • getDefaultConstraintMessageTemplate
  • unwrap

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • getContentResolver (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Table (org.hibernate.mapping)
    A relational table
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now