本文整理匯總了Java中org.codehaus.plexus.util.xml.Xpp3Dom.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Xpp3Dom.getValue方法的具體用法?Java Xpp3Dom.getValue怎麽用?Java Xpp3Dom.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.plexus.util.xml.Xpp3Dom
的用法示例。
在下文中一共展示了Xpp3Dom.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: simpleProperty
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
static @NonNull ConfigurationBuilder<String> simpleProperty(final @NonNull String property) {
return new ConfigurationBuilder<String>() {
@Override
public String build(Xpp3Dom configRoot, ExpressionEvaluator eval) {
if (configRoot != null) {
Xpp3Dom source = configRoot.getChild(property);
if (source != null) {
String value = source.getValue();
if (value == null) {
return null;
}
return value.trim();
}
}
return null;
}
};
}
示例2: listProperty
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
static @NonNull ConfigurationBuilder<String[]> listProperty(final @NonNull String multiProperty, final @NonNull String singleProperty) {
return new ConfigurationBuilder<String[]>() {
@Override
public String[] build(Xpp3Dom conf, ExpressionEvaluator eval) {
if (conf != null) {
Xpp3Dom dom = (Xpp3Dom) conf; // MNG-4862
Xpp3Dom source = dom.getChild(multiProperty);
if (source != null) {
List<String> toRet = new ArrayList<String>();
Xpp3Dom[] childs = source.getChildren(singleProperty);
for (Xpp3Dom ch : childs) {
String chvalue = ch.getValue() == null ? "" : ch.getValue().trim(); //NOI18N
toRet.add(chvalue); //NOI18N
}
return toRet.toArray(new String[toRet.size()]);
}
}
return null;
}
};
}
示例3: getValueFromServerConfiguration
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Get string value from server configuration section in settings.xml.
*
* @param server Server object.
* @param key Key string.
* @return String value if key exists; otherwise, return null.
*/
public static String getValueFromServerConfiguration(final Server server, final String key) {
if (server == null) {
return null;
}
final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
if (configuration == null) {
return null;
}
final Xpp3Dom node = configuration.getChild(key);
if (node == null) {
return null;
}
return node.getValue();
}
示例4: getCompileTargetVersion
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Determines the Java compiler target version by inspecting the project's maven-compiler-plugin
* configuration.
*
* @return The Java compiler target version.
*/
public String getCompileTargetVersion() {
// maven-plugin-compiler default is 1.5
String javaVersion = "1.5";
if (mavenProject != null) {
// check the maven.compiler.target property first
String mavenCompilerTargetProperty = mavenProject.getProperties()
.getProperty("maven.compiler.target");
if (mavenCompilerTargetProperty != null) {
javaVersion = mavenCompilerTargetProperty;
} else {
Plugin compilerPlugin = mavenProject
.getPlugin("org.apache.maven.plugins:maven-compiler-plugin");
if (compilerPlugin != null) {
Xpp3Dom config = (Xpp3Dom) compilerPlugin.getConfiguration();
if (config != null) {
Xpp3Dom domVersion = config.getChild("target");
if (domVersion != null) {
javaVersion = domVersion.getValue();
}
}
}
}
}
return javaVersion;
}
示例5: addExcludedGroups
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private Xpp3Dom addExcludedGroups(Xpp3Dom configNode) {
for (Xpp3Dom config : configNode.getChildren()) {
if ("excludedGroups".equals(config.getName())) {
Logger.getGlobal().log(Level.INFO, "Adding excluded groups to existing ones");
String current = config.getValue();
// Should not add duplicate entry for NonDexIgnore
if (current.contains("edu.illinois.NonDexIgnore")) {
return configNode;
}
current = "," + current;
// It seems there is an error if you have the variable
// in the excludedGroups string concatenated (in any
// position) to the concrete class we are adding to
// the excludedGroups
// ${excludedGroups} appears when
// there is no excludedGroups specified in the pom
// and potentially in other situations
current = current.replace(",${excludedGroups}", "");
config.setValue("edu.illinois.NonDexIgnore" + current);
return configNode;
}
}
Logger.getGlobal().log(Level.INFO, "Adding excluded groups to newly created one");
configNode.addChild(this.makeNode("excludedGroups", "edu.illinois.NonDexIgnore"));
return configNode;
}
示例6: resolveFromRootThenParent
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private String resolveFromRootThenParent(Xpp3Dom pluginPomDom, String element) throws Exception {
Xpp3Dom elementDom = pluginPomDom.getChild(element);
if (elementDom == null) {
Xpp3Dom pluginParentDom = pluginPomDom.getChild("parent");
if (pluginParentDom != null) {
elementDom = pluginParentDom.getChild(element);
if (elementDom == null) {
throw new Exception("unable to determine " + element);
} else {
return elementDom.getValue();
}
} else {
throw new Exception("unable to determine " + element);
}
} else {
return elementDom.getValue();
}
}
示例7: getWarSrcDir
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Returns the war source directory such as src/main/webapp
*
* @param mavenProject
*
* @param config
* gwt-maven-maven config DOM
* @return the {@link #WAR_SRC_DIR_PROPERTY_KEY} value from the config if it exists, {@link #WAR_SRC_DIR_DEFAULT}
* otherwise or if config is null
*/
private static final IPath getWarSrcDir(MavenProject mavenProject, Xpp3Dom config) {
String spath = WAR_SRC_DIR_DEFAULT;
if (config != null) {
for (Xpp3Dom child : config.getChildren()) {
if (child != null && WAR_SRC_DIR_PROPERTY_KEY.equals(child.getName())) {
spath = child.getValue() == null ? WAR_SRC_DIR_DEFAULT : child.getValue().trim();
}
}
}
IPath path = null;
if (spath != null) {
path = new Path(spath);
String basePath = mavenProject.getBasedir().toPath().toAbsolutePath().toString();
String fullPath = basePath + "/" + spath;
java.io.File fullPathFile = new java.io.File(fullPath);
if (!fullPathFile.exists()) {
path = null;
}
}
return path;
}
示例8: getOutputDir
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private File getOutputDir() {
File outputDir = new File(project.getBasedir(), "res");
List<Plugin> plugins = project.getBuildPlugins();
for (Plugin plugin : plugins) {
if (plugin.getGroupId().equals("com.jayway.maven.plugins.android.generation2") && plugin.getArtifactId().equals("android-maven-plugin")) {
Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration();
Xpp3Dom resDir = dom.getChild("resourceDirectory");
if (resDir != null) {
outputDir = new File(resDir.getValue());
}
}
}
return outputDir;
}
示例9: getServiceUnitName
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
protected String getServiceUnitName(MavenProject project) {
for (Object elem : project.getBuildPlugins()) {
if (elem instanceof Plugin) {
Plugin plugin = (Plugin)elem;
if (plugin.getGroupId().equals("org.apache.servicemix.tooling")
&& plugin.getArtifactId().equals("jbi-maven-plugin")) {
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom serviceUnitName = configuration.getChild("serviceUnitName");
if (serviceUnitName != null) {
return serviceUnitName.getValue();
}
}
break;
}
}
}
return null;
}
示例10: getNativesPath
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
public static String getNativesPath(MavenProject mavenProject)
{
Object configuration = getNativesPlugin(mavenProject).getConfiguration();
if (configuration instanceof Xpp3Dom)
{
Xpp3Dom confDom = (Xpp3Dom) configuration;
Xpp3Dom nativesPathConfig = confDom.getChild(nativesPathAttribute);
if(nativesPathConfig!=null)
{
String nativesPathConfigValue = nativesPathConfig.getValue();
if(nativesPathConfigValue!=null && !nativesPathConfigValue.equals(""))
{
return nativesPathConfigValue;
}
}
}
return defaultNativesPath;
}
示例11: getArtifacts
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
protected static String[] getArtifacts(Xpp3Dom config, String artifactTag) {
Xpp3Dom oldArtifactsXml = config == null ? null : config.getChild(artifactTag);
if (oldArtifactsXml == null) {
return new String[0];
}
if (oldArtifactsXml.getChildCount() == 0) {
String artifact = oldArtifactsXml.getValue();
return new String[]{artifact};
} else {
String[] ret = new String[oldArtifactsXml.getChildCount()];
for (int i = 0; i < oldArtifactsXml.getChildCount(); ++i) {
ret[i] = oldArtifactsXml.getChild(i).getValue();
}
return ret;
}
}
示例12: getJavaVersion
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* @return the java version used the pom (target) and 1.7 if not present.
*/
protected String getJavaVersion() {
String javaVersion = "1.7";
Plugin p = maven_project.getPlugin("org.apache.maven.plugins:maven-compiler-plugin");
if (p != null) {
Xpp3Dom config = (Xpp3Dom) p.getConfiguration();
if (config == null) {
return javaVersion;
}
Xpp3Dom domVersion = config.getChild("target");
if (domVersion != null) {
javaVersion = domVersion.getValue();
}
}
return javaVersion;
}
示例13: processChildren
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Recursively process the DOM elements to inline any property values from the model.
* @param userProperties
* @param model
* @param parent
*/
private void processChildren( Properties userProperties, Model model, Xpp3Dom parent )
{
for ( int i = 0; i < parent.getChildCount(); i++ )
{
Xpp3Dom child = parent.getChild( i );
if ( child.getChildCount() > 0 )
{
processChildren( userProperties, model, child );
}
if ( child.getValue() != null && child.getValue().startsWith( "${" ) )
{
String replacement = resolveProperty( userProperties, model.getProperties(), child.getValue() );
if ( replacement != null && !replacement.isEmpty() )
{
logger.debug( "Replacing child value " + child.getValue() + " with " + replacement );
child.setValue( replacement );
}
}
}
}
示例14: parseStrings
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private List<String> parseStrings( Xpp3Dom dom )
{
List<String> strings = null;
if ( dom != null )
{
strings = new ArrayList<String>();
for ( Xpp3Dom child : dom.getChildren() )
{
String string = child.getValue();
if ( string != null )
{
string = string.trim();
if ( string.length() > 0 )
{
strings.add( string );
}
}
}
}
return strings;
}
示例15: getValue
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private static Object getValue( Xpp3Dom node )
{
if ( node.getValue() != null )
{
return node.getValue();
}
else
{
List<Object> children = new ArrayList<Object>();
for ( int i = 0; i < node.getChildCount(); i++ )
{
children.add( getValue( node.getChild( i ) ) );
}
return children;
}
}