Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2014 Philip Helger (www.helger.com) philip[at]helger[dot]com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package com.helger.appbasics.security.password.constraint;
Password constraint defining the maximum length (incl.)

Author(s):
Philip Helger
  private static final String ATTR_MAX_LENGTH = "maxlength";
  private final int m_nMaxLength;
  public PasswordConstraintMaxLength (@Nonnegative final int nMaxLength)
  {
     = ValueEnforcer.isGT0 (nMaxLength"MaxLength");
  }
  public int getMaxLength ()
  {
    return ;
  }
  public boolean isPasswordValid (@Nullable final String sPlainTextPassword)
  {
    return StringHelper.getLength (sPlainTextPassword) <= ;
  }
  public String getDescription (@Nonnull final Locale aContentLocale)
  {
                                                                           Integer.valueOf ());
  }
  public void fillMicroElement (@Nonnull final IMicroElement aElement)
  {
  }
  public boolean equals (final Object o)
  {
    if (o == this)
      return true;
    if (o == null || !getClass ().equals (o.getClass ()))
      return false;
    return  == rhs.m_nMaxLength;
  }
  public int hashCode ()
  {
    return new HashCodeGenerator (this).append ().getHashCode ();
  }
  public String toString ()
  {
    return new ToStringGenerator (this).append ("maxLength").toString ();
  }
New to GrepCode? Check out our FAQ X