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


Java PlexusConfiguration.getChildCount方法代码示例

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


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

示例1: write

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
private void write(PlexusConfiguration c, XMLWriter w, int depth) throws IOException {
  int count = c.getChildCount();

  if (count == 0) {
    writeTag(c, w, depth);
  } else {
    w.startElement(c.getName());
    writeAttributes(c, w);

    for (int i = 0; i < count; i++) {
      PlexusConfiguration child = c.getChild(i);

      write(child, w, depth + 1);
    }

    w.endElement();
  }
}
 
开发者ID:orctom,项目名称:was-maven-plugin,代码行数:19,代码来源:AntXmlPlexusConfigurationWriter.java

示例2: toIndentedString

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
static void toIndentedString(PlexusConfiguration xml, int indentationSize, int currentDepth, Writer wrt)
        throws IOException {

    indent(indentationSize, currentDepth, wrt);

    boolean hasChildren = xml.getChildCount() > 0;
    boolean hasContent = xml.getValue() != null && !xml.getValue().isEmpty();
    wrt.write('<');
    wrt.write(xml.getName());
    if (!hasChildren && !hasContent) {
        wrt.write("/>");
    } else {
        wrt.write('>');
        if (hasChildren) {
            wrt.write('\n');
            for (PlexusConfiguration c : xml.getChildren()) {
                toIndentedString(c, indentationSize, currentDepth + 1, wrt);
                wrt.append('\n');
            }

            if (!hasContent) {
                indent(indentationSize, currentDepth, wrt);
            }
        }

        if (hasContent) {
            wrt.write(xml.getValue());
        }

        wrt.write("</");
        wrt.write(xml.getName());
        wrt.write('>');
    }
}
 
开发者ID:revapi,项目名称:revapi,代码行数:35,代码来源:XmlUtil.java

示例3: validateParameters

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
private void validateParameters( MojoDescriptor mojoDescriptor, PlexusConfiguration configuration,
                                 ExpressionEvaluator expressionEvaluator )
    throws ComponentConfigurationException, PluginParameterException
{
    if ( mojoDescriptor.getParameters() == null )
    {
        return;
    }

    List<Parameter> invalidParameters = new ArrayList<Parameter>();

    for ( Parameter parameter : mojoDescriptor.getParameters() )
    {
        if ( !parameter.isRequired() )
        {
            continue;
        }

        Object value = null;

        PlexusConfiguration config = configuration.getChild( parameter.getName(), false );
        if ( config != null )
        {
            String expression = config.getValue( null );

            try
            {
                value = expressionEvaluator.evaluate( expression );

                if ( value == null )
                {
                    value = config.getAttribute( "default-value", null );
                }
            }
            catch ( ExpressionEvaluationException e )
            {
                String msg =
                    "Error evaluating the expression '" + expression + "' for configuration value '"
                        + configuration.getName() + "'";
                throw new ComponentConfigurationException( configuration, msg, e );
            }
        }

        if ( value == null && ( config == null || config.getChildCount() <= 0 ) )
        {
            invalidParameters.add( parameter );
        }
    }

    if ( !invalidParameters.isEmpty() )
    {
        throw new PluginParameterException( mojoDescriptor, invalidParameters );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:55,代码来源:DefaultMavenPluginManager.java

示例4: processConfiguration

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
public void processConfiguration(final ConverterLookup converterLookup,
		final Object object, final ClassLoader classLoader,
		final PlexusConfiguration configuration,
		final ExpressionEvaluator expressionEvaluator,
		final ConfigurationListener listener)
		throws ComponentConfigurationException {
	final int items = configuration.getChildCount();

	for (int i = 0; i < items; i++) {
		final PlexusConfiguration childConfiguration = configuration
				.getChild(i);

		final String elementName = childConfiguration.getName();

		Class<?> implementation;
		try {
			implementation = getClassForImplementationHint(null,
					childConfiguration, classLoader);
		} catch (final Exception e) {
			implementation = null; // fall back to original behavior
		}

		final ComponentValueSetter valueSetter = new ComponentValueSetter(
				fromXML(elementName), implementation, object,
				converterLookup, listener);

		valueSetter.configure(childConfiguration, classLoader,
				expressionEvaluator);
	}

	Class<?> mojoClass = object.getClass();

	while (mojoClass != Object.class) {
		Field[] declaredFields = mojoClass.getDeclaredFields();
		List<PropertyEditorField> editorSupportFields = new ArrayList<PropertyEditorField>();
		for (Field declaredField : declaredFields) {
			if (declaredField.isAnnotationPresent(PropertyEditor.class)) {
				PropertyEditorField propertyEditorField = new PropertyEditorField(
						object, declaredField);
				editorSupportFields.add(propertyEditorField);
			}
		}

		handlePropertyEditorFields(object, editorSupportFields,
				expressionEvaluator);
		mojoClass = mojoClass.getSuperclass();
	}
}
 
开发者ID:link-intersystems,项目名称:maven,代码行数:49,代码来源:PropertyEditorSupportConverter.java


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