本文整理匯總了Java中org.jdom2.Attribute.getIntValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Attribute.getIntValue方法的具體用法?Java Attribute.getIntValue怎麽用?Java Attribute.getIntValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdom2.Attribute
的用法示例。
在下文中一共展示了Attribute.getIntValue方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseEnchantmentStorage
import org.jdom2.Attribute; //導入方法依賴的package包/類
public static EnchantmentStorageMeta parseEnchantmentStorage(Element xml, EnchantmentStorageMeta source) {
Element book = xml.getChild("enchanted-book");
if (book != null) {
for (Element enchantment : book.getChildren("enchantment")) {
Enchantment type = Enchantment.getByName(XMLParser.parseEnumValue(enchantment.getTextNormalize()));
int level = 1;
try {
Attribute levelAttribute = enchantment.getAttribute("level");
if (levelAttribute != null) {
level = levelAttribute.getIntValue();
}
} catch (DataConversionException ignored) {
}
source.addStoredEnchant(type, level, false);
}
}
return source;
}
示例2: parseEnchantments
import org.jdom2.Attribute; //導入方法依賴的package包/類
private static Map<Enchantment, Integer> parseEnchantments(Element xml) {
Map<Enchantment, Integer> enchantments = new HashMap<>();
Element element = xml.getChild("enchantments");
if (element != null) {
for (Element enchantment : element.getChildren("enchantment")) {
Enchantment type = Enchantment.getByName(XMLParser.parseEnumValue(enchantment.getTextNormalize()));
int level = 1;
try {
Attribute levelAttribute = enchantment.getAttribute("level");
if (levelAttribute != null) {
level = levelAttribute.getIntValue();
}
} catch (DataConversionException ignored) {
}
enchantments.put(type, level);
}
}
return enchantments;
}
示例3: parseMaxPlayers
import org.jdom2.Attribute; //導入方法依賴的package包/類
public static int parseMaxPlayers(Element xml) {
Attribute attribute = xml.getAttribute("overfill");
if (attribute != null) {
try {
return attribute.getIntValue();
} catch (DataConversionException ignored) {
}
}
return 0;
}
示例4: parseMinPlayers
import org.jdom2.Attribute; //導入方法依賴的package包/類
public static int parseMinPlayers(Element xml) {
Attribute attribute = xml.getAttribute("min-players");
if (attribute != null) {
try {
return attribute.getIntValue();
} catch (DataConversionException ignored) {
}
}
return 0;
}
示例5: parseSlots
import org.jdom2.Attribute; //導入方法依賴的package包/類
public static int parseSlots(Element xml) {
Attribute attribute = xml.getAttribute("slots");
if (attribute != null) {
try {
return attribute.getIntValue();
} catch (DataConversionException ignored) {
}
}
return 0;
}
示例6: parseAmount
import org.jdom2.Attribute; //導入方法依賴的package包/類
private static int parseAmount(Element xml) {
Attribute attribute = xml.getAttribute("amount");
if (attribute != null) {
try {
return attribute.getIntValue();
} catch (DataConversionException ignored) {
}
}
return 1;
}
示例7: parseSlot
import org.jdom2.Attribute; //導入方法依賴的package包/類
private int parseSlot(Element xml) {
Attribute attribute = xml.getAttribute("slot");
if (attribute != null) {
try {
return attribute.getIntValue();
} catch (DataConversionException ignored) {
}
}
return SLOT_NULL;
}
示例8: parseAmplifier
import org.jdom2.Attribute; //導入方法依賴的package包/類
private static int parseAmplifier(Element xml) {
Attribute attribute = xml.getAttribute("amplifier");
if (attribute != null) {
try {
return attribute.getIntValue();
} catch (DataConversionException ignored) {
}
}
return 1;
}