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


Java Validate.notNull方法代碼示例

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


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

示例1: get

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public synchronized T get(final long timeout, final TimeUnit unit)
		throws InterruptedException, ExecutionException, TimeoutException {
	Validate.notNull(unit, "Time unit");
	final long msecs = unit.toMillis(timeout);
	final long startTime = (msecs <= 0) ? 0 : System.currentTimeMillis();
	long waitTime = msecs;
	if (this.completed) {
		return getResult();
	} else if (waitTime <= 0) {
		throw new TimeoutException();
	} else {
		for (;;) {
			wait(waitTime);
			if (this.completed) {
				return getResult();
			} else {
				waitTime = msecs - (System.currentTimeMillis() - startTime);
				if (waitTime <= 0) {
					throw new TimeoutException();
				}
			}
		}
	}
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:26,代碼來源:BasicFuture.java

示例2: getColumnNumberForValueGroup

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Contract(pure = true)
public static int getColumnNumberForValueGroup(@NotNull final ImpexValueGroup valueGroup) {
    Validate.notNull(valueGroup);

    final ImpexValueLine valueLine = PsiTreeUtil.getParentOfType(valueGroup, ImpexValueLine.class);
    final List<ImpexValueGroup> valueGroups = PsiTreeUtil.getChildrenOfTypeAsList(valueLine, ImpexValueGroup.class);

    int columnNumber = 0;

    for (ImpexValueGroup group : valueGroups) {
        if (group == valueGroup) {
            return columnNumber;
        }

        columnNumber++;
    }

    return -1;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:20,代碼來源:ImpexPsiUtils.java

示例3: removeAllFiles

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public void removeAllFiles(@NotNull final Collection<File> files) throws IOException {
    Validate.notNull(files);

    if (files.isEmpty()) {
        return;
    }

    final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();

    for (File file : files) {
        final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file);

        if (null != virtualFile) {
            ApplicationManager.getApplication().runWriteAction(new RemoveFileComputable(virtualFile));
        } else {
            FileUtil.delete(file);
        }
    }
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:21,代碼來源:DefaultVirtualFileSystemService.java

示例4: processAddOnBackwardDependencies

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
protected void processAddOnBackwardDependencies(@NotNull final List<JavaLibraryDescriptor> libs) {
    Validate.notNull(libs);

    if (!getRootProjectDescriptor().isCreateBackwardCyclicDependenciesForAddOn()) {
        return;
    }

    final List<DefaultJavaLibraryDescriptor> backwardDependencies =
        this.getDependenciesTree()
            .stream()
            .filter(moduleDescriptor -> moduleDescriptor.getRequiredExtensionNames().contains(this.getName()))
            .map(moduleDescriptor -> new DefaultJavaLibraryDescriptor(
                new File(moduleDescriptor.getRootDirectory(), HybrisConstants.WEB_WEBINF_LIB_DIRECTORY),
                false,
                false
            ))
            .collect(Collectors.toList());

    libs.addAll(backwardDependencies);
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:21,代碼來源:RegularHybrisModuleDescriptor.java

示例5: apply

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@SuppressWarnings("StandardVariableNames")
@Nullable
@Override
public String apply(@Nullable final ImpexModifierValue f) {
    Validate.notNull(f);

    return f.getModifierValue();
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:9,代碼來源:ImpexModifierValueToStringConversionFunction.java

示例6: StorageSetMetadataRequest

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * 設置文件元數據
 * 
 * @param groupName
 * @param path
 * @param metaDataSet
 * @param type
 */
public StorageSetMetadataRequest(String groupName, String path, Set<MateData> metaDataSet,
        StorageMetdataSetType type) {
    super();
    Validate.notBlank(groupName, "分組不能為空");
    Validate.notBlank(path, "分組不能為空");
    Validate.notEmpty(metaDataSet, "分組不能為空");
    Validate.notNull(type, "標簽設置方式不能為空");
    this.groupName = groupName;
    this.path = path;
    this.metaDataSet = metaDataSet;
    this.opFlag = OtherConstants.STORAGE_SET_METADATA_FLAG_MERGE;
    head = new ProtoHead(CmdConstants.STORAGE_PROTO_CMD_SET_METADATA);
}
 
開發者ID:whatodo,項目名稱:FastDFS_Client,代碼行數:22,代碼來源:StorageSetMetadataRequest.java

示例7: moveFile

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * 文件移動/重命名.
 */
public static void moveFile(@NotNull File from, @NotNull File to) throws IOException {
	Validate.isTrue(isFileExists(from), from + " is not exist or not a file");
	Validate.notNull(to);
	Validate.isTrue(!isDirExists(to), to + " is  exist but it is a dir");

	Files.move(from, to);
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:11,代碼來源:FileUtil.java

示例8: remove

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
@Transactional
default boolean remove(ID id) {
    Validate.notNull(id, "Identifier cannot be null");

    val entityOpt = get(id);

    if (!entityOpt.isPresent())
        return false;

    val entity = entityOpt.get();
    exec(() -> delete(entity));

    return true;
}
 
開發者ID:wingsofovnia,項目名稱:ddd-support,代碼行數:16,代碼來源:SpringMutableRepository.java

示例9: AbstractHybrisModuleDescriptor

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public AbstractHybrisModuleDescriptor(
    @NotNull final File moduleRootDirectory,
    @NotNull final HybrisProjectDescriptor rootProjectDescriptor
) throws HybrisConfigurationException {
    Validate.notNull(moduleRootDirectory);
    Validate.notNull(rootProjectDescriptor);

    this.moduleRootDirectory = moduleRootDirectory;
    this.rootProjectDescriptor = rootProjectDescriptor;

    if (!this.moduleRootDirectory.isDirectory()) {
        throw new HybrisConfigurationException("Can not find module directory using path: " + moduleRootDirectory);
    }
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:15,代碼來源:AbstractHybrisModuleDescriptor.java

示例10: equals

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public boolean equals( Object obj ) {
    Validate.notNull( obj);
    Validate.isInstanceOf( Vector2i.class, obj, "Object has to be from type Vector2i" );

    Vector2i other = (Vector2i) obj;

    if(other.getX() != x) return false;
    if(other.getY() != y) return false;
    return true;
}
 
開發者ID:LegendOnline,項目名稱:InventoryAPI,代碼行數:12,代碼來源:Vector2i.java

示例11: DefaultJavaLibraryDescriptor

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public DefaultJavaLibraryDescriptor(
    @NotNull final File libraryFile,
    final boolean isExported,
    final boolean isDirectoryWithClasses
) {
    Validate.notNull(libraryFile);

    this.libraryFile = libraryFile;
    this.sourcesFile = null;
    this.isExported = isExported;
    this.isDirectoryWithClasses = isDirectoryWithClasses;
    this.scope = DependencyScope.COMPILE;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:14,代碼來源:DefaultJavaLibraryDescriptor.java

示例12: enchant

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * Adds an unsafe enchantment
 * @param e the {@link Enchantment} to be added
 * @param val the Enchantment's level
 * @return this ItemBuilder
 */
public ItemBuilder enchant( Enchantment e, int val){
    Validate.notNull( e , "Enchantment is null");
    Validate.notNull( val , "Enchantment Level is null");
    item.addUnsafeEnchantment( e, val );
    return this;
}
 
開發者ID:LegendOnline,項目名稱:InventoryAPI,代碼行數:13,代碼來源:ItemBuilder.java

示例13: apply

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public static byte[] apply(final @Nonnull byte[] bytes, final @Nonnull String name, final @Nonnull TransformProvider context) {
	Validate.notNull(bytes);
	final ClassReader cr = new ClassReader(bytes);
	final ClassWriter cw = new ClassWriter(cr, context.flags);
	final ClassVisitor mod = context.createVisitor(name, cw);

	try {
		cr.accept(mod, 0);
		return cw.toByteArray();
	} catch (final StopTransforming e) {
		return bytes;
	}
}
 
開發者ID:Team-Fruit,項目名稱:McHeliPrivacyShield,代碼行數:14,代碼來源:VisitorHelper.java

示例14: addScheduledTask

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public ListenableFuture<Object> addScheduledTask(Runnable runnableToSchedule) {
	Validate.notNull(runnableToSchedule);
	return this.<Object>addScheduledTask(Executors.callable(runnableToSchedule));
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:5,代碼來源:Minecraft.java

示例15: User

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public User(String name, String password, boolean admin) {
    this.name = Validate.notNull(name);
    this.password = password;
    this.admin = admin;
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:6,代碼來源:User.java


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