本文整理汇总了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();
}
}
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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));
}
示例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;
}