本文整理匯總了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;
}