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


Java PlexusConfiguration.getName方法代码示例

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


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

示例1: toXppDom

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
/**
 * Recursively convert PLEXUS config to Xpp3Dom.
 * @param config The config to convert
 * @return The Xpp3Dom document
 * @see #execute(String,String,Properties)
 */
private Xpp3Dom toXppDom(final PlexusConfiguration config) {
    final Xpp3Dom result = new Xpp3Dom(config.getName());
    result.setValue(config.getValue(null));
    for (final String name : config.getAttributeNames()) {
        try {
            result.setAttribute(name, config.getAttribute(name));
        } catch (final PlexusConfigurationException ex) {
            throw new IllegalArgumentException(ex);
        }
    }
    for (final PlexusConfiguration child : config.getChildren()) {
        result.addChild(this.toXppDom(child));
    }
    return result;
}
 
开发者ID:teamed,项目名称:qulice,代码行数:22,代码来源:MojoExecutor.java

示例2: convertPlexusConfiguration

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
private Xpp3Dom convertPlexusConfiguration(PlexusConfiguration config) {

    Xpp3Dom xpp3DomElement = new Xpp3Dom(config.getName());
    xpp3DomElement.setValue(config.getValue());

    for (String name : config.getAttributeNames()) {
      xpp3DomElement.setAttribute(name, config.getAttribute(name));
    }

    for (PlexusConfiguration child : config.getChildren()) {
      xpp3DomElement.addChild(convertPlexusConfiguration(child));
    }

    return xpp3DomElement;
  }
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-maven-plugin,代码行数:16,代码来源:AppengineEnhancerMojo.java

示例3: toXpp3Dom

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
/**
 * Taken from MojoExecutor of Don Brown. Converts PlexusConfiguration to a Xpp3Dom.
 * 
 * @param config the PlexusConfiguration. Must not be {@code null}.
 * @return the Xpp3Dom representation of the PlexusConfiguration
 */
public Xpp3Dom toXpp3Dom( PlexusConfiguration config )
{
    Xpp3Dom result = new Xpp3Dom( config.getName() );
    result.setValue( config.getValue( null ) );
    for ( String name : config.getAttributeNames() )
    {
        result.setAttribute( name, config.getAttribute( name ) );
    }
    for ( PlexusConfiguration child : config.getChildren() )
    {
        result.addChild( toXpp3Dom( child ) );
    }
    return result;
}
 
开发者ID:khmarbaise,项目名称:iterator-maven-plugin,代码行数:21,代码来源:IteratorMojo.java

示例4: convert

import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
public static Xpp3Dom convert( MojoDescriptor mojoDescriptor )
{
    Xpp3Dom dom = new Xpp3Dom( "configuration" );

    PlexusConfiguration c = mojoDescriptor.getMojoConfiguration();

    PlexusConfiguration[] ces = c.getChildren();

    if ( ces != null )
    {
        for ( PlexusConfiguration ce : ces )
        {
            String value = ce.getValue( null );
            String defaultValue = ce.getAttribute( "default-value", null );
            if ( value != null || defaultValue != null )
            {
                Xpp3Dom e = new Xpp3Dom( ce.getName() );
                e.setValue( value );
                if ( defaultValue != null )
                {
                    e.setAttribute( "default-value", defaultValue );
                }
                dom.addChild( e );
            }
        }
    }

    return dom;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:30,代码来源:MojoDescriptorCreator.java

示例5: 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

示例6: 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.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。