org.jdom2.Attribute.getIntValue()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(35)

本文整理了Java中org.jdom2.Attribute.getIntValue()方法的一些代码示例,展示了Attribute.getIntValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getIntValue()方法的具体详情如下:
包路径:org.jdom2.Attribute
类名称:Attribute
方法名:getIntValue

Attribute.getIntValue介绍

[英]This gets the value of the attribute, in int form, and if no conversion can occur, throws a DataConversionException
[中]它以int的形式获取属性的值,如果无法进行转换,则抛出DataConversionException

代码示例

代码示例来源:origin: jwpttcg66/NettyGameServer

public void load(Element element) throws DataConversionException {
  serverId = element.getAttribute("serverId").getIntValue();
  domain = element.getAttributeValue("domain");
  domainPort = element.getAttribute("domainPort").getIntValue();
  ip = element.getAttributeValue("ip");
  port = element.getAttribute("port").getIntValue();
  weight = element.getAttribute("weight").getIntValue();
  maxNumber = element.getAttribute("maxNumber").getIntValue();
  rpcPort = element.getAttribute("rpcPort").getIntValue();
  rpcClientNumber = element.getAttribute("rpcClientNumber").getIntValue();
}

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

private Integer parseIntegerAttribute(Element sharingChild, String attrName) {
  Attribute integerAttribute = sharingChild.getAttribute(attrName);
  Integer integerAttr = null;
  if (integerAttribute != null) {
    try {
      integerAttr = new Integer(integerAttribute.getIntValue());
    } catch (DataConversionException e) {
      // dont use the data
    }
  }
  return integerAttr;
}

代码示例来源:origin: rometools/rome

private Integer parseIntegerAttribute(final Element sharingChild, final String attrName) {
  final Attribute integerAttribute = sharingChild.getAttribute(attrName);
  Integer integerAttr = null;
  if (integerAttribute != null) {
    try {
      integerAttr = new Integer(integerAttribute.getIntValue());
    } catch (final DataConversionException e) {
      // dont use the data
    }
  }
  return integerAttr;
}

代码示例来源:origin: apache/marmotta

private Integer parseIntegerAttribute(Element sharingChild, String attrName) {
  Attribute integerAttribute = sharingChild.getAttribute(attrName);
  Integer integerAttr = null;
  if (integerAttribute != null) {
    try {
      integerAttr = integerAttribute.getIntValue();
    } catch (DataConversionException e) {
      // dont use the data
    }
  }
  return integerAttr;
}

代码示例来源:origin: com.rometools/rome-modules

private Integer parseIntegerAttribute(final Element sharingChild, final String attrName) {
  final Attribute integerAttribute = sharingChild.getAttribute(attrName);
  Integer integerAttr = null;
  if (integerAttribute != null) {
    try {
      integerAttr = new Integer(integerAttribute.getIntValue());
    } catch (final DataConversionException e) {
      // dont use the data
    }
  }
  return integerAttr;
}

代码示例来源:origin: io.wcm/io.wcm.handler.commons

/**
 * Gets attribute value as integer.
 * @param attributeName Attribute name
 * @return Attribute value as integer or 0 if not set.
 */
public final int getAttributeValueAsInteger(String attributeName) {
 Attribute attribute = getAttribute(attributeName);
 if (attribute == null) {
  return 0;
 }
 else {
  try {
   return attribute.getIntValue();
  }
  catch (DataConversionException ex) {
   return 0;
  }
 }
}

代码示例来源:origin: Renanse/Ardor3D

/**
 * Parse an int value in an attribute.
 *
 * @param input
 *            Element containing the attribute
 * @param attributeName
 *            Attribute name to parse a value for
 * @return parsed integer
 */
public int getAttributeIntValue(final Element input, final String attributeName, final int defaultVal) {
  final Attribute attribute = input.getAttribute(attributeName);
  if (attribute != null) {
    try {
      return attribute.getIntValue();
    } catch (final DataConversionException e) {
      logger.log(Level.WARNING, "Could not parse int value", e);
    }
  }
  return defaultVal;
}

代码示例来源:origin: jpos/jPOS

XML_CONFIG_ATTR__EXEC_SRV_COREPOOLSIZE, true,
      "(number of threads in the pool)");
  initialCorePoolSize = corePoolSizeAttr.getIntValue();
      "(number of threads in the pool)");
  if (null != corePoolSizeAttr) {
    initialCorePoolSize = corePoolSizeAttr.getIntValue();
      XML_CONFIG_ATTR__EXEC_SRV_COREPOOLSIZE, true,
      "(number of threads in the pool)");
  initialCorePoolSize = corePoolSizeAttr.getIntValue();
    "(termination timer in seconds)");
if (null != terminationTimerAttr) {
  terminationTimer = terminationTimerAttr.getIntValue();

代码示例来源:origin: vasl-developers/vasl

e.getAttribute(colorRedAttribute).getIntValue(),
    e.getAttribute(colorGreenAttribute).getIntValue(),
    e.getAttribute(colorBlueAttribute).getIntValue()
);

代码示例来源:origin: Renanse/Ardor3D

@Override
public void setAttribute(final Element parent, final Attribute a) {
  if ("id".equals(a.getName())) {
    if (dataCache.getIdCache().containsKey(a.getValue())) {
      logger.warning("id already exists in id cache: " + a.getValue());
    }
    dataCache.getIdCache().put(a.getValue(), parent);
  } else if ("sid".equals(a.getName())) {
    dataCache.getSidCache().put(a.getValue(), parent);
  } else if ("count".equals(a.getName())) {
    try {
      count = a.getIntValue();
    } catch (final DataConversionException e) {
      e.printStackTrace();
    }
  }
  super.setAttribute(parent, a);
}

代码示例来源:origin: sc.fiji/TrackMate_

try
  trackID = trackElement.getAttribute( TRACK_ID_ATTRIBUTE_NAME_v12 ).getIntValue();

代码示例来源:origin: sc.fiji/TrackMate_

public static final int readIntAttribute(final Element element, final String name, final Logger logger, final int defaultValue) {
  int val = defaultValue;
  final Attribute att = element.getAttribute(name);
  if (null == att) {
    logger.error("Could not find attribute "+name+" for element "+element.getName()+", substituting default value: "+defaultValue+".\n");
    return val;
  }
  try {
    val = att.getIntValue();
  } catch (final DataConversionException e) {
    logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value: "+defaultValue+".\n");
  }
  return val;
}

代码示例来源:origin: fiji/TrackMate

try
  trackID = trackElement.getAttribute( TRACK_ID_ATTRIBUTE_NAME_v12 ).getIntValue();

代码示例来源:origin: fiji/TrackMate

public static final int readIntAttribute(final Element element, final String name, final Logger logger, final int defaultValue) {
  int val = defaultValue;
  final Attribute att = element.getAttribute(name);
  if (null == att) {
    logger.error("Could not find attribute "+name+" for element "+element.getName()+", substituting default value: "+defaultValue+".\n");
    return val;
  }
  try {
    val = att.getIntValue();
  } catch (final DataConversionException e) {
    logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value: "+defaultValue+".\n");
  }
  return val;
}

代码示例来源:origin: fiji/TrackMate

try
  trackID = trackElement.getAttribute( TrackIndexAnalyzer.TRACK_ID ).getIntValue();

代码示例来源:origin: sc.fiji/TrackMate_

try
  trackID = trackElement.getAttribute( TrackIndexAnalyzer.TRACK_ID ).getIntValue();

代码示例来源:origin: vasl-developers/vasl

rule.addImage(new OverlaySSRuleImage(
    e.getAttributeValue(overlaySSRImageAttribute),
    e.getAttribute(overlaySSRXAttribute).getIntValue(),
    e.getAttribute(overlaySSRYAttribute).getIntValue()));
overlaySSRules.put(rule.getName(), rule);
    rule.addImage(new OverlaySSRuleImage(
        image.getAttributeValue(overlaySSRImageAttribute),
        image.getAttribute(overlaySSRXAttribute).getIntValue(),
        image.getAttribute(overlaySSRYAttribute).getIntValue()));

代码示例来源:origin: net.sf.cuf/cuf-swing

orientation = orientationAttribute.getIntValue();

代码示例来源:origin: vasl-developers/vasl

counterMetadata.setHeight(e.getAttribute(counterHeightAttribute).getIntValue());
counterMetadata.setHindrance(e.getAttribute(counterHindranceAttribute).getIntValue());
counterMetadata.setLevel(e.getAttribute(counterLevelAttribute).getIntValue());
counterMetadata.setPosition(e.getAttributeValue(counterPositionAttribute));
counterMetadata = new CounterMetadata(name, CounterMetadata.CounterType.CREST);
counterMetadata.setPosition(e.getAttributeValue(counterPositionAttribute));
counterMetadata.setCoverArch(e.getAttribute(counterCoveredArchAttribute).getIntValue());
counterMetadata.setLevel(e.getAttribute(counterLevelAttribute).getIntValue());
counterMetadata.setPosition(e.getAttributeValue(counterPositionAttribute));
counterMetadata.setCoverArch(e.getAttribute(counterCoveredArchAttribute).getIntValue());

代码示例来源:origin: ssaring/sportstracker

int iRed = eColor.getAttribute("red").getIntValue();
  int iGreen = eColor.getAttribute("green").getIntValue();
  int iBlue = eColor.getAttribute("blue").getIntValue();
  sportType.setColor(Color.rgb(iRed, iGreen, iBlue));
} catch (DataConversionException dce) {

相关文章