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


Java Validate.notBlank方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.Validate.notBlank方法的典型用法代碼示例。如果您正苦於以下問題:Java Validate.notBlank方法的具體用法?Java Validate.notBlank怎麽用?Java Validate.notBlank使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.Validate的用法示例。


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

示例1: getAccessibleField

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * 循環向上轉型, 獲取對象的DeclaredField, 並強製設置為可訪問.
 * <p>
 * 如向上轉型到Object仍無法找到, 返回null.
 */
public static Field getAccessibleField(final Object obj, final String fieldName) {
	Validate.notNull(obj, "object can't be null");
	Validate.notBlank(fieldName, "fieldName can't be blank");
	for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
		try {
			Field field = superClass.getDeclaredField(fieldName);
			makeAccessible(field);
			return field;
		} catch (NoSuchFieldException e) {//NOSONAR
			// Field不在當前類定義,繼續向上轉型
			continue;// new add
		}
	}
	return null;
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:21,代碼來源:Reflections.java

示例2: parseAndinstantiate

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public static Segment parseAndinstantiate(String segmentText, Seperators seperators, HashMap<String, Class<? extends Segment>> zSegmentDefinitions) throws ParseException {
    Validate.notBlank(segmentText);
    Validate.notNull(seperators);

    String segmentName = getSegmentName(segmentText, seperators);
    Class<? extends Segment> segmentClass = getSegmentClass(segmentName, zSegmentDefinitions);

    try {
        Constructor<? extends Segment> constructor = segmentClass.getConstructor(String.class, Seperators.class);

        if (constructor == null)
            throw new ParseException("Could not find constructor for segment " + segmentClass);

        return constructor.newInstance(segmentText, seperators);
    } catch (Exception e) {
        throw new ParseException("Could not instantiate segment " + segmentClass);
    }
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:19,代碼來源:Segment.java

示例3: getAccessibleMethodByName

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * 循環向上轉型, 獲取對象的DeclaredMethod,並強製設置為可訪問.
 * 如向上轉型到Object仍無法找到, 返回null.
 * 隻匹配函數名。
 *
 * 用於方法需要被多次調用的情況. 先使用本函數先取得Method,然後調用Method.invoke(Object obj, Object... args)
 */
public static Method getAccessibleMethodByName(final Object obj, final String methodName) {
    Validate.notNull(obj, "object can't be null");
    Validate.notBlank(methodName, "methodName can't be blank");

    for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) {
        Method[] methods = searchType.getDeclaredMethods();
        for (Method method : methods) {
            if (method.getName().equals(methodName)) {
                makeAccessible(method);
                return method;
            }
        }
    }
    return null;
}
 
開發者ID:sombie007,項目名稱:ExcelHandle,代碼行數:23,代碼來源:Reflections.java

示例4: init

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * initialize the (implementation) internalCompiler by providing a workspace directory which could be used
 * to save the dependencies and compiled *.class file
 *
 * @param workspace
 * @param dependencyResolver
 * @param internalCompiler
 */
public void init(String workspace, DependencyResolver dependencyResolver, InternalCompiler internalCompiler) {
    log.info("initializing internalCompiler with workspace {}", workspace);

    Validate.notBlank(workspace, "provided workspace cannot be null");
    Validate.notNull(dependencyResolver, "provded dependency resolver cannot be null");
    Validate.notNull(internalCompiler, "provided internalCompiler cannot be null");

    this.workspace = workspace;
    this.dependencyResolver = dependencyResolver;
    this.internalCompiler = internalCompiler;

    final File workspaceDir = Paths.get(workspace).toAbsolutePath().toFile();
    Validate.isTrue(workspaceDir.isDirectory(), "provided workspace must be a directory.");
    Validate.isTrue(workspaceDir.canRead() && workspaceDir.canWrite(), "read or write permission denied.");
    log.info("initialized.");
}
 
開發者ID:dshell-io,項目名稱:dshell,代碼行數:25,代碼來源:DefaultJavaFileCompiler.java

示例5: getAccessibleMethodByName

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * 循環向上轉型, 獲取對象的DeclaredMethod,並強製設置為可訪問.
 * 如向上轉型到Object仍無法找到, 返回null.
 * 隻匹配函數名。
 * <p/>
 * 用於方法需要被多次調用的情況. 先使用本函數先取得Method,然後調用Method.invoke(Object obj, Object... args)
 */
public static Method getAccessibleMethodByName(final Object obj, final String methodName) {
    Validate.notNull(obj, "object can't be null");
    Validate.notBlank(methodName, "methodName can't be blank");

    for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) {
        Method[] methods = searchType.getDeclaredMethods();
        for (Method method : methods) {
            if (method.getName().equals(methodName)) {
                makeAccessible(method);
                return method;
            }
        }
    }
    return null;
}
 
開發者ID:wxiaoqi,項目名稱:ace-cache,代碼行數:23,代碼來源:ReflectionUtils.java

示例6: afterPropertiesSet

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public void afterPropertiesSet() throws Exception {
    if (!QiniuProvider.NAME.equals(provider) && !FdfsProvider.NAME.equals(provider)) {
        throw new RuntimeException("Provider[" + provider + "] not support");
    }

    if (QiniuProvider.NAME.equals(provider)) {
        Validate.notBlank(accessKey, "[accessKey] not defined");
        Validate.notBlank(secretKey, "[secretKey] not defined");
        fsProvider = new QiniuProvider(urlprefix, groupName, accessKey, secretKey);
    } else if (FdfsProvider.NAME.equals(provider)) {
        Validate.isTrue(servers != null && servers.matches("^.+[:]\\d{1,5}\\s*$"),
            "[servers] is not valid");
        String[] serversArray = servers.split(",|;");
        fsProvider = new FdfsProvider(urlprefix, groupName, serversArray, connectTimeout,
            maxThreads);
    }
}
 
開發者ID:warlock-china,項目名稱:azeroth,代碼行數:19,代碼來源:FSProviderSpringFacade.java

示例7: Message

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public Message(final String messageText, HashMap<String, Class<? extends Segment>> zSegmentDefinitions) throws ParseException {
    Validate.notBlank(messageText);

    this.originalMessageText = messageText;
    this.zSegmentDefinitions = zSegmentDefinitions;
    parse(messageText);
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:8,代碼來源:Message.java

示例8: mapPractitionerUuidWithLocalHospitalIdentifiers

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public UUID mapPractitionerUuidWithLocalHospitalIdentifiers(String surname, String forename, String localPrimaryAssigningAuthority, String localPrimaryIdentifierValue) throws MapperException {
    Validate.notBlank(surname + forename);
    Validate.notBlank(localPrimaryAssigningAuthority);
    Validate.notBlank(localPrimaryIdentifierValue);

    String identifier = ResourceMapParameters.create()
            .put(SurnameKey, surname)
            .put(ForenameKey, forename)
            .put(PractitionerIdentifierAssigningAuthorityCodeKey, localPrimaryAssigningAuthority)
            .put(PractitionerIdentifierValueKey, localPrimaryIdentifierValue)
            .createIdentifyingString();

    return this.mapper.mapScopedResourceUuid(ResourceType.Practitioner, identifier);
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:15,代碼來源:ResourceMapper.java

示例9: mapPractitionerUuidWithConsultantCode

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public UUID mapPractitionerUuidWithConsultantCode(String surname, String forename, String consultantCode) throws MapperException {
    Validate.notBlank(surname + forename);
    Validate.notBlank(consultantCode);

    String identifier = ResourceMapParameters.create()
            .put(SurnameKey, surname)
            .put(ForenameKey, forename)
            .put(ConsultantCodeKey, consultantCode)
            .createIdentifyingString();

    return this.mapper.mapScopedResourceUuid(ResourceType.Practitioner, identifier);
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:13,代碼來源:ResourceMapper.java

示例10: init

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@PostConstruct
public void init() throws MalformedURLException {
    Validate.notBlank(scriptDir, "script.directory cannot be empty");
    final File directory = Paths.get(scriptDir).toAbsolutePath().toFile();
    log.info("script.directory is {}", directory.toString());
    Validate.isTrue(directory.isDirectory(), "script.directory must be a directory.");
    Validate.isTrue(directory.canRead(), "script.directory must be readable.");

    runtime = new Runtime(getScriptClassLoader(directory));
}
 
開發者ID:dshell-io,項目名稱:dshell,代碼行數:11,代碼來源:HttpServletScriptController.java

示例11: run

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public String run(Context context) throws Exception {
    final String functionName = context.getString("name");
    final String language = context.getString("language");
    final String artifact = context.getString("artifact");
    final Boolean dind = context.getBoolean("dind");

    final URI artifactURI = new URI(artifact);
    Validate.notBlank(functionName, "name parameter cannot be empty.");
    Validate.notBlank(language, "language parameter cannot be empty.");
    Validate.notBlank(artifact, "artifact parameter cannot be empty.");

    final Task task = Task.builder()
                          .name(functionName)
                          .dind(dind)
                          .language(language)
                          .volumes(context.getString("volumes"))
                          .artifact(artifactURI)
                          .build();
    final Future<TaskResult> runningResult = engine.run(task);
    try {
        return runningResult.get().getTaskId().getId();
    } catch (Exception ex) {
        //TODO: log ex
        return null;
    }
}
 
開發者ID:dshell-io,項目名稱:dshell,代碼行數:28,代碼來源:DeployFunction.java

示例12: mapParametersUuid

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public UUID mapParametersUuid(String messageControlId, String parametersType) throws MapperException {
    Validate.notBlank(messageControlId);
    Validate.notBlank(parametersType);

    String identifier = ResourceMapParameters.create()
            .put(MessageControlIdKey, messageControlId)
            .put(ParametersTypeKey, parametersType)
            .createIdentifyingString();

    return this.mapper.mapScopedResourceUuid(ResourceType.Parameters, identifier);
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:12,代碼來源:ResourceMapper.java

示例13: mapMessageHeaderUuid

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public UUID mapMessageHeaderUuid(String messageControlId) throws MapperException {
    Validate.notBlank(messageControlId);

    String identifier = ResourceMapParameters.create()
            .put(MessageControlIdKey, messageControlId)
            .createIdentifyingString();

    return this.mapper.mapScopedResourceUuid(ResourceType.MessageHeader, identifier);
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:10,代碼來源:ResourceMapper.java

示例14: fetchResource

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public <T extends IBaseResource> T fetchResource(FhirContext theContext, Class<T> theClass, String theUri) {
  Validate.notBlank(theUri, "theUri must not be null or blank");

  if (theClass.equals(StructureDefinition.class)) {
    return (T) fetchStructureDefinition(theContext, theUri);
  }

  if (theClass.equals(ValueSet.class) || theUri.startsWith(URL_PREFIX_VALUE_SET)) {
    return (T) fetchValueSet(theContext, theUri);
  }

  return null;
}
 
開發者ID:nhsconnect,項目名稱:careconnect-reference-implementation,代碼行數:16,代碼來源:SNOMEDUKMockValidationSupport.java

示例15: validate

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
private void validate() {
    Validate.notNull(config, "config");
    Validate.notBlank(dateTimeFormatPattern, "dateTimeFormatPattern");
    Validate.notBlank(timeZoneId, "timeZoneId");
    Validate.isTrue(
            !StringUtils.isBlank(template) || !StringUtils.isBlank(templateUri),
            "both template and templateUri are blank");
}
 
開發者ID:vy,項目名稱:log4j2-logstash-layout,代碼行數:9,代碼來源:LogstashLayout.java


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