本文整理汇总了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.");
}
}
示例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());
}
示例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;
}
示例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;
}
示例5: BaseUrlCapabilityConfiguration
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
public BaseUrlCapabilityConfiguration(final Map<String,String> properties) {
checkNotNull(properties);
this.url = properties.get(URL);
}
示例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";
}
示例7: getUrl
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
@Size(max = 100)
@URL
@Column(name = "URL", length = 100)
public String getUrl() {
return url;
}
示例8: getHomepage
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
/**
* @return the homepage
*/
@URL
public String getHomepage() {
return homepage;
}
示例9: getUri
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
@URL
@Size(max = 255)
public String getUri() {
return uri;
}
示例10: getHomepage
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
/**
* @return the homepage
*/
@URL
public String getHomepage() {
return homepage;
}
示例11: getLogoUrl
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
/**
* @return the logoUrl
*/
@URL
public String getLogoUrl() {
return logoUrl;
}
示例12: getUri
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
/**
* @return the uri
*/
@NotEmpty(groups = ReadResource.class)
@URL
public String getUri() {
return uri;
}
示例13: getResource
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
/**
* @return the resource
*/
@URL
public String getResource() {
return resource;
}
示例14: getArtistUrl
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
@URL(message = "artistUrl#format#must be a valid URL")
public String getArtistUrl()
{
return artistUrl;
}
示例15: getLyricsUrl
import org.hibernate.validator.constraints.URL; //导入依赖的package包/类
@URL(message = "lyricsUrl#format#must be a valid URL")
public String getLyricsUrl()
{
return lyricsUrl;
}