本文整理了Java中org.apache.avalon.framework.configuration.Configuration.getAttributeNames()
方法的一些代码示例,展示了Configuration.getAttributeNames()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getAttributeNames()
方法的具体详情如下:
包路径:org.apache.avalon.framework.configuration.Configuration
类名称:Configuration
方法名:getAttributeNames
[英]Return an array of all attribute names.
The order of attributes in this array can not be relied on. As with XML, a Configuration
's attributes are an unordered set. If your code relies on order, eg conf.getAttributeNames()[0], then it is liable to break if a different XML parser is used.
[中]返回所有属性名称的数组。
无法依赖此数组中属性的顺序。与XML一样,Configuration
的属性是一个无序集。如果您的代码依赖于顺序,例如conf.getAttributeNames()[0],那么如果使用不同的XML解析器,它很容易崩溃。
代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl
/**
* Return true if the attributes of both configurations are equal.
*
* @param c1 configuration1
* @param c2 configuration2
* @return true if the attributes of both configurations are equal.
*/
private static boolean areAttributesEqual( final Configuration c1,
final Configuration c2 )
{
final String[] names1 = c1.getAttributeNames();
final String[] names2 = c2.getAttributeNames();
if( names1.length != names2.length )
{
return false;
}
for( int i = 0; i < names1.length; i++ )
{
final String name = names1[ i ];
final String value1 = c1.getAttribute( name, null );
final String value2 = c2.getAttribute( name, null );
if( !value1.equals( value2 ) )
{
return false;
}
}
return true;
}
代码示例来源:origin: com.cloudhopper.proxool/proxool
private Attributes getAttributes(Configuration configuration) throws ConfigurationException {
final AttributesImpl attributes = new AttributesImpl();
final String[] avalonAttributeNames = configuration.getAttributeNames();
if (avalonAttributeNames != null && avalonAttributeNames.length > 0) {
for (int i = 0; i < avalonAttributeNames.length; ++i) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding attribute " + avalonAttributeNames[i] + " with value "
+ configuration.getAttribute(avalonAttributeNames[i]));
}
attributes.addAttribute("", avalonAttributeNames[i], avalonAttributeNames[i], "CDATA",
configuration.getAttribute(avalonAttributeNames[i]));
LOG.debug("In attributes: " + avalonAttributeNames[i] + " with value "
+ attributes.getValue(avalonAttributeNames[i]));
}
}
return attributes;
}
}
代码示例来源:origin: org.logicalcobwebs/com.springsource.org.logicalcobwebs.proxool
private Attributes getAttributes(Configuration configuration) throws ConfigurationException {
final AttributesImpl attributes = new AttributesImpl();
final String[] avalonAttributeNames = configuration.getAttributeNames();
if (avalonAttributeNames != null && avalonAttributeNames.length > 0) {
for (int i = 0; i < avalonAttributeNames.length; ++i) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding attribute " + avalonAttributeNames[i] + " with value "
+ configuration.getAttribute(avalonAttributeNames[i]));
}
attributes.addAttribute("", avalonAttributeNames[i], avalonAttributeNames[i], "CDATA",
configuration.getAttribute(avalonAttributeNames[i]));
LOG.debug("In attributes: " + avalonAttributeNames[i] + " with value "
+ attributes.getValue(avalonAttributeNames[i]));
}
}
return attributes;
}
}
代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl
final String[] names = configuration.getAttributeNames();
for( int i = 0; i < names.length; i++ )
代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl
/**
* Add all attributes from specified configuration
* element to current configuration element.
*
* @param other the {@link Configuration} element
*/
public void addAllAttributes( final Configuration other )
{
checkWriteable();
final String[] attributes = other.getAttributeNames();
for( int i = 0; i < attributes.length; i++ )
{
final String name = attributes[ i ];
final String value = other.getAttribute( name, null );
setAttribute( name, value );
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-util
final String[] names = configuration.getAttributeNames();
for( int i = 0; i < names.length; i++ )
代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl
String[] attrNames = element.getAttributeNames();
代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl
final String[] attributes = config.getAttributeNames();
if( attributes.length > 0 )
代码示例来源:origin: org.apache.excalibur.fortress.container/excalibur-fortress-container-impl
( (DefaultContext) m_context ).put( "component.logger", configuration.getAttribute( "logger", name ) );
String[] attribNames = configuration.getAttributeNames();
内容来源于网络,如有侵权,请联系作者删除!