當前位置: 首頁>>代碼示例>>Java>>正文


Java URL類代碼示例

本文整理匯總了Java中org.hibernate.validator.constraints.URL的典型用法代碼示例。如果您正苦於以下問題:Java URL類的具體用法?Java URL怎麽用?Java URL使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


URL類屬於org.hibernate.validator.constraints包,在下文中一共展示了URL類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testAssertURL

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@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.");
	}
}
 
開發者ID:bradwoo8621,項目名稱:nest-old,代碼行數:17,代碼來源:TestObject.java

示例2: testAvatarURL

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@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());
}
 
開發者ID:tosinoni,項目名稱:SECP,代碼行數:9,代碼來源:UserTest.java

示例3: isValidSimpleConstraint

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
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;
}
 
開發者ID:Erudika,項目名稱:para,代碼行數:26,代碼來源:ValidationUtils.java

示例4: getType

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@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;
}
 
開發者ID:arey,項目名稱:spring-mvc-toolkit,代碼行數:19,代碼來源:Html5InputTag.java

示例5: BaseUrlCapabilityConfiguration

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
public BaseUrlCapabilityConfiguration(final Map<String,String> properties) {
  checkNotNull(properties);
  this.url = properties.get(URL);
}
 
開發者ID:sonatype,項目名稱:nexus-public,代碼行數:5,代碼來源:BaseUrlCapabilityConfiguration.java

示例6: getApiBaseUrl

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@URL
public String getApiBaseUrl() {

    return sandboxed
            ? "http://sandboxapi.ihealthlabs.com/OpenApiV2"
            : "https://api.ihealthlabs.com:8443/OpenApiV2";
}
 
開發者ID:openmhealth,項目名稱:shimmer,代碼行數:8,代碼來源:IHealthClientSettings.java

示例7: getUrl

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@Size(max = 100)
@URL
@Column(name = "URL", length = 100)
public String getUrl() {
    return url;
}
 
開發者ID:jaxio,項目名稱:celerio-angular-quickstart,代碼行數:7,代碼來源:Project.java

示例8: getHomepage

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
/**
 * @return the homepage
 */
@URL
public String getHomepage() {
	return homepage;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:8,代碼來源:RegistrationForm.java

示例9: getUri

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@URL
@Size(max = 255)
public String getUri() {
	return uri;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:6,代碼來源:BaseData.java

示例10: getHomepage

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
/**
 * @return the homepage
 */
@URL
public String getHomepage() {
 return homepage;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:8,代碼來源:User.java

示例11: getLogoUrl

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
/**
 * @return the logoUrl
 */
@URL
public String getLogoUrl() {
 return logoUrl;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:8,代碼來源:Organisation.java

示例12: getUri

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
/**
 * @return the uri
 */
@NotEmpty(groups = ReadResource.class)
@URL
public String getUri() {
	return uri;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:9,代碼來源:Resource.java

示例13: getResource

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
/**
 * @return the resource
 */
@URL
public String getResource() {
	return resource;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:8,代碼來源:Resource.java

示例14: getArtistUrl

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@URL(message = "artistUrl#format#must be a valid URL")
public String getArtistUrl()
{
    return artistUrl;
}
 
開發者ID:phavelar,項目名稱:boot-camper,代碼行數:6,代碼來源:Song.java

示例15: getLyricsUrl

import org.hibernate.validator.constraints.URL; //導入依賴的package包/類
@URL(message = "lyricsUrl#format#must be a valid URL")
public String getLyricsUrl()
{
    return lyricsUrl;
}
 
開發者ID:phavelar,項目名稱:boot-camper,代碼行數:6,代碼來源:Song.java


注:本文中的org.hibernate.validator.constraints.URL類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。