本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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();
}
}