当前位置: 首页>>代码示例>>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;未经允许,请勿转载。