Java 类org.hibernate.validator.constraints.URL 实例源码

项目:nest-old    文件:TestObject.java   
@Test
public void testAssertURL() {
    Set<ConstraintViolation<ObjectWithValidation>> violations = validator.validate(obj, URL.class);
    assertNotNull(violations);
    assertEquals(violations.size(), 1);

    if (runPeformance) {
        long time = System.currentTimeMillis();
        for (int index = 0; index < 10000; index++) {
            validator.validate(obj, URL.class);
        }
        long used = System.currentTimeMillis() - time;
        System.out.println("Hibernate Validator [AssertURL] check used " + used + "ms, avg. " + ((double) used)
                / 10000 + "ms.");
    }
}
项目:SECP    文件:UserTest.java   
@Test
public void testAvatarURL(){
    AssertAnnotations.assertField(User.class,"avatarurl", URL.class, Column.class);

    Column c = ReflectTool.getFieldAnnotation(User.class, "avatarurl", Column.class);
    assertEquals("column avatar_url: avatar_url is not equal", "avatar_url", c.name());
    assertEquals("column avatar_url: nullable is true", false, c.nullable());
}
项目:para    文件:ValidationUtils.java   
private static boolean isValidSimpleConstraint(String cName, String field, Object actual, LinkedList<String> err) {
    if ("required".equals(cName) && !required().isValid(actual)) {
        err.add(Utils.formatMessage("{0} is required.", field));
        return false;
    } else if (matches(AssertFalse.class, cName) && !falsy().isValid(actual)) {
        err.add(Utils.formatMessage("{0} must be false.", field));
        return false;
    } else if (matches(AssertTrue.class, cName) && !truthy().isValid(actual)) {
        err.add(Utils.formatMessage("{0} must be true.", field));
        return false;
    } else if (matches(Future.class, cName) && !future().isValid(actual)) {
        err.add(Utils.formatMessage("{0} must be in the future.", field));
        return false;
    } else if (matches(Past.class, cName) && !past().isValid(actual)) {
        err.add(Utils.formatMessage("{0} must be in the past.", field));
        return false;
    } else if (matches(URL.class, cName) && !url().isValid(actual)) {
        err.add(Utils.formatMessage("{0} is not a valid URL.", field));
        return false;
    } else if (matches(Email.class, cName) && !email().isValid(actual)) {
        err.add(Utils.formatMessage("{0} is not a valid email.", field));
        return false;
    }
    return true;
}
项目:spring-mvc-toolkit    文件:Html5InputTag.java   
@Override
protected String getType()  {
    String type = javaToHtmlTypes.get(valueType);
    if (type != null) {
        return type;
    }
    type = "text";
    if (annotations != null) {
        if (annotations.containsKey(Email.class)) {
            type = "email";
        } else if (annotations.containsKey(URL.class)) {
            type = "url";
        } else if (annotations.containsKey(Max.class) || annotations.containsKey(Min.class)) {
            type = "number";
        }
    }
    return type;
}
项目:nexus-public    文件:BaseUrlCapabilityConfiguration.java   
public BaseUrlCapabilityConfiguration(final Map<String,String> properties) {
  checkNotNull(properties);
  this.url = properties.get(URL);
}
项目:shimmer    文件:IHealthClientSettings.java   
@URL
public String getApiBaseUrl() {

    return sandboxed
            ? "http://sandboxapi.ihealthlabs.com/OpenApiV2"
            : "https://api.ihealthlabs.com:8443/OpenApiV2";
}
项目:celerio-angular-quickstart    文件:Project.java   
@Size(max = 100)
@URL
@Column(name = "URL", length = 100)
public String getUrl() {
    return url;
}
项目:eMonocot    文件:RegistrationForm.java   
/**
 * @return the homepage
 */
@URL
public String getHomepage() {
    return homepage;
}
项目:eMonocot    文件:BaseData.java   
@URL
@Size(max = 255)
public String getUri() {
    return uri;
}
项目:eMonocot    文件:User.java   
/**
 * @return the homepage
 */
@URL
public String getHomepage() {
 return homepage;
}
项目:eMonocot    文件:Organisation.java   
/**
 * @return the logoUrl
 */
@URL
public String getLogoUrl() {
 return logoUrl;
}
项目:eMonocot    文件:Resource.java   
/**
 * @return the uri
 */
@NotEmpty(groups = ReadResource.class)
@URL
public String getUri() {
    return uri;
}
项目:eMonocot    文件:Resource.java   
/**
 * @return the resource
 */
@URL
public String getResource() {
    return resource;
}
项目:powop    文件:BaseData.java   
@URL
@Size(max = 255)
public String getUri() {
    return uri;
}
项目:boot-camper    文件:Song.java   
@URL(message = "artistUrl#format#must be a valid URL")
public String getArtistUrl()
{
    return artistUrl;
}
项目:boot-camper    文件:Song.java   
@URL(message = "lyricsUrl#format#must be a valid URL")
public String getLyricsUrl()
{
    return lyricsUrl;
}
项目:parkandrideAPI    文件:MultilingualUrl.java   
@URL(regexp = "(?i)^(?:http://|https://).*")
@Override
public String getFi() {
    return super.getFi();
}
项目:parkandrideAPI    文件:MultilingualUrl.java   
@URL(regexp = "(?i)^(?:http://|https://).*")
@Override
public String getSv() {
    return super.getSv();
}
项目:parkandrideAPI    文件:MultilingualUrl.java   
@URL(regexp = "(?i)^(?:http://|https://).*")
@Override
public String getEn() {
    return super.getEn();
}
项目:cm_ext    文件:ParcelDescriptor.java   
/**
 * THe user can add a parcel repo URL. If one is specified,
 * it will be added to the remote repository urls so that the
 * associated parcel can show up in CM.
 */
@URL
String getRepoUrl();