当前位置: 首页>>代码示例>>Java>>正文


Java Validate.notNull方法代码示例

本文整理汇总了Java中org.apache.commons.lang.Validate.notNull方法的典型用法代码示例。如果您正苦于以下问题:Java Validate.notNull方法的具体用法?Java Validate.notNull怎么用?Java Validate.notNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.Validate的用法示例。


在下文中一共展示了Validate.notNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tabComplete

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
@Override
public List<String> tabComplete(CommandSender sender,String alias,String[] args){
    Validate.notNull(sender,"Sender cannot be null");
    Validate.notNull(args,"Arguments cannot be null");
    Validate.notNull(alias,"Alias cannot be null");

    if(args.length==1){
        return StringUtil.copyPartialMatches(args[0],COMMANDS,new ArrayList<String>(COMMANDS.size()));
    }
    if(((args.length==2)&&"get".equalsIgnoreCase(args[0]))||"set".equalsIgnoreCase(args[0])){
        MinecraftServer.getServer();
        MinecraftServer.getServer();
        return StringUtil.copyPartialMatches(args[1],MinecraftServer.entityConfig.getSettings().keySet(),new ArrayList<String>(MinecraftServer.tileEntityConfig.getSettings().size()));
    }

    return ImmutableList.of();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:18,代码来源:EntityCommand.java

示例2: setDisplayName

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
public void setDisplayName(String displayName) throws IllegalStateException, IllegalArgumentException {
    Validate.notNull(displayName, "Display name cannot be null");
    Validate.isTrue(displayName.length() <= 32, "Display name '" + displayName + "' is longer than the limit of 32 characters");
    CraftScoreboard scoreboard = checkState();

    objective.setDisplayName(displayName);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:8,代码来源:CraftObjective.java

示例3: addDefaults

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
public void addDefaults( Map<String, Object> defaults )
{
	Validate.notNull( defaults, "Defaults may not be null" );

	for ( Map.Entry<String, Object> entry : defaults.entrySet() ) {
		addDefault( entry.getKey(), entry.getValue() );
	}
}
 
开发者ID:ZP4RKER,项目名称:zlevels,代码行数:9,代码来源:MemoryConfiguration.java

示例4: getEnchantmentLevel

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
@Override
public int getEnchantmentLevel(Enchantment ench) {
    Validate.notNull(ench, "Cannot find null enchantment");
    if (handle == null) {
        return 0;
    }
    return net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(ench.getId(), handle);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:9,代码来源:CraftItemStack.java

示例5: initialize

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
private synchronized void initialize(Addon addon) {
    Validate.notNull(addon, "Initializing addon cannot be null");
    Validate.isTrue(addon.getClass().getClassLoader() == this, "Cannot initialize plugin outside of this class loader");
    if (this.addon.getDescription() != null) {
        throw new IllegalArgumentException("Addon already initialized!");
    } else {
        addon.init(this, this.dataFolder, this.description);
    }
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:10,代码来源:AddonClassLoader.java

示例6: MemorySection

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
/**
 * Creates an empty MemorySection with the specified parent and path.
 *
 * @param parent Parent section that contains this own section.
 * @param path   Path that you may access this section from via the root
 *               {@link Configuration}.
 * @throws IllegalArgumentException Thrown is parent or path is null, or
 *                                  if parent contains no root Configuration.
 */
protected MemorySection( ConfigurationSection parent, String path )
{
	Validate.notNull( parent, "Parent cannot be null" );
	Validate.notNull( path, "Path cannot be null" );

	this.path = path;
	this.parent = parent;
	this.root = parent.getRoot();

	Validate.notNull( root, "Path cannot be orphaned" );

	this.fullPath = createPath( parent, path );
}
 
开发者ID:ZP4RKER,项目名称:zlevels,代码行数:23,代码来源:MemorySection.java

示例7: DragonTemplate

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
/**
 * Construct a new DragonTemplate object
 * 
 * @param file the file holding this template data
 * @param name the name of the dragon. Can be null
 * @param barStyle the style of the bar. Can be null
 * @param barColour the colour of the bar. Can be null
 */
public DragonTemplate(File file, String name, BarStyle barStyle, BarColor barColour) {
	Validate.notNull(file, "File cannot be null. See DragonTemplate(String, String, BarStyle, BarColor) for null files");
	
	this.file = file;
	this.configFile = YamlConfiguration.loadConfiguration(file);
	this.identifier = file.getName().substring(0, file.getName().lastIndexOf('.'));
	
	this.name = (name != null ? ChatColor.translateAlternateColorCodes('&', name) : null);
	this.barStyle = (barStyle != null ? barStyle : BarStyle.SOLID);
	this.barColour = (barColour != null ? barColour : BarColor.PINK);
	this.loot = new DragonLoot(this);
}
 
开发者ID:2008Choco,项目名称:DragonEggDrop,代码行数:21,代码来源:DragonTemplate.java

示例8: removeAttribute

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
/**
 * Remove an attribute from this template and set its value back to default
 * 
 * @param attribute the attribute to remove
 * @param updateFile whether to update the dragon file or not
 */
public void removeAttribute(Attribute attribute, boolean updateFile) {
	Validate.notNull(attribute, "Cannot remove a null attribute");
	
	this.attributes.remove(attribute);
	
	if (updateFile) {
		this.updateConfig("attributes." + attribute.name(), null);
	}
}
 
开发者ID:2008Choco,项目名称:DragonEggDrop,代码行数:16,代码来源:DragonTemplate.java

示例9: tabComplete

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
@Override
public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException {
	Validate.notNull(sender, "Sender cannot be null");
	Validate.notNull(args, "Arguments cannot be null");
	Validate.notNull(alias, "Alias cannot be null");

	List<String> completions = null;
	try {
		if (completer != null) {
			completions = completer.onTabComplete(sender, this, alias, args);
		}
		if (completions == null && executor instanceof TabCompleter) {
			completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args);
		}
	} catch (Throwable ex) {
		StringBuilder message = new StringBuilder();
		message.append("Unhandled exception during tab completion for command '/").append(alias).append(' ');
		for (String arg : args) {
			message.append(arg).append(' ');
		}
		message.deleteCharAt(message.length() - 1).append("' in plugin ")
				.append(owningPlugin.getDescription().getFullName());
		throw new CommandException(message.toString(), ex);
	}

	if (completions == null) {
		return super.tabComplete(sender, alias, args);
	}
	return completions;
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:31,代码来源:BukkitCommand.java

示例10: addEntry

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
@Override
public void addEntry(String player) throws IllegalStateException,IllegalArgumentException{
    Validate.notNull(player, "PlayerName cannot be null");
    CraftScoreboard scoreboard = checkState();

    scoreboard.board.func_151392_a(player, team.getRegisteredName());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:8,代码来源:CraftTeam.java

示例11: CocoaEffectsModule

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param plugin Parent plugin
 * @param api API instance
 * @param moduleConfiguration Module configuration
 */
public CocoaEffectsModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
    super(plugin, api, moduleConfiguration);
    Validate.notNull(moduleConfiguration, "Configuration cannot be null!");

    this.bonusTime = (int) moduleConfiguration.get("bonus-time");
    this.penaltyTime = (int) moduleConfiguration.get("penalty-time");

    this.cocoa = new ItemStack(Material.INK_SACK, 5, (short) 3);
    ItemMeta meta = this.cocoa.getItemMeta();
    meta.setLore(Arrays.asList(ChatColor.GRAY + "Chaque utilisation vous donne " + this.bonusTime + " secondes", ChatColor.GRAY + " de force et vitesse améliorées", ChatColor.GRAY + " mais les effets contraires par la suite", ChatColor.GRAY + " pendant " + this.penaltyTime + " secondes."));
    meta.setDisplayName(ChatColor.AQUA + "Coco");
    this.cocoa.setItemMeta(meta);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:22,代码来源:CocoaEffectsModule.java

示例12: ConstantPotionModule

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param plugin Parent plugin
 * @param api API instance
 * @param moduleConfiguration Module configuration
 */
public ConstantPotionModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
    super(plugin, api, moduleConfiguration);
    Validate.notNull(moduleConfiguration, "Configuration cannot be null!");

    this.potionEffects = (ArrayList<PotionEffect>) this.moduleConfiguration.get("effects");
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:15,代码来源:ConstantPotionModule.java

示例13: Builder

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
public Builder(final VoyageNumber voyageNumber, final Location departureLocation) {
    Validate.notNull(voyageNumber, "Voyage number is required");
    Validate.notNull(departureLocation, "Departure location is required");

    this.voyageNumber = voyageNumber;
    this.departureLocation = departureLocation;
}
 
开发者ID:jboz,项目名称:living-documentation,代码行数:8,代码来源:Voyage.java

示例14: setProfession

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
public void setProfession(Profession profession) {
    Validate.notNull(profession);
    getHandle().setProfession(profession.getId());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:5,代码来源:CraftVillager.java

示例15: clearSlot

import org.apache.commons.lang.Validate; //导入方法依赖的package包/类
public void clearSlot(DisplaySlot slot) throws IllegalArgumentException {
    Validate.notNull(slot, "Slot cannot be null");
    board.func_96530_a(CraftScoreboardTranslations.fromBukkitSlot(slot), null);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:5,代码来源:CraftScoreboard.java


注:本文中的org.apache.commons.lang.Validate.notNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。