本文整理匯總了Java中org.codehaus.plexus.util.StringUtils類的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils類的具體用法?Java StringUtils怎麽用?Java StringUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StringUtils類屬於org.codehaus.plexus.util包,在下文中一共展示了StringUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validoiLaakemaaraysUusiminen
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
/**
* Validoi cda:n muodostamisen kannalta tarvittavien parametrien tilan.
*/
protected void validoiLaakemaaraysUusiminen() {
if (null == getUusi()) {
throw new IllegalArgumentException("Uusittu lääkemääräys ei saa olla null.");
}
if (null == getUusi().getMaarayspaiva()) {
throw new IllegalArgumentException("Uusitun lääkemääräyksen 'määräyspäivä' ei saa olla null.");
}
if (StringUtils.isEmpty(getUusi().getOid())) {
throw new IllegalArgumentException("Uusitun lääkemääräyksen 'oid' pitää löytyä.");
}
if (null == getUusi().getMaarayspaiva()) {
throw new IllegalArgumentException("Uusitun lääkemääräyksen 'setid' pitää löytyä.");
}
validoiHenkilotiedot(getUusi().getPotilas());
}
開發者ID:TheFinnishSocialInsuranceInstitution,項目名稱:KantaCDA-API,代碼行數:20,代碼來源:ReseptinUusimisValidoija.java
示例2: validoiAlkuperainenLaakemaarays
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
/**
* Validoi alkuperäisen LaakemaraysTOn
*
* @param laakemaarays LaakemaaraysTO joka validoidaan
*/
public void validoiAlkuperainenLaakemaarays() {
if (null == getAlkuperainenLaakemaarays()) {
throw new IllegalArgumentException("Alkuperäinen lääkemääräys ei saa olla null.");
}
if (null == getAlkuperainenLaakemaarays().getMaarayspaiva()) {
throw new IllegalArgumentException("Alkuperäisen lääkemääräyksen 'määräyspäivä' ei saa olla null.");
}
if (StringUtils.isEmpty(getAlkuperainenLaakemaarays().getOid())) {
throw new IllegalArgumentException("Alkuperäisen lääkemääräyksen 'oid' pitää löytyä.");
}
if (null == getAlkuperainenLaakemaarays().getMaarayspaiva()) {
throw new IllegalArgumentException("Alkuperäisen lääkemääräyksen 'setid' pitää löytyä.");
}
}
開發者ID:TheFinnishSocialInsuranceInstitution,項目名稱:KantaCDA-API,代碼行數:21,代碼來源:ReseptinUusimisValidoija.java
示例3: addRelatedDocument
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
@Override
protected void addRelatedDocument(POCDMT000040ClinicalDocument clinicalDocument, String oid, String setid,
String propertycode, XActRelationshipDocument relationType) {
POCDMT000040RelatedDocument relatedDocument = of.createPOCDMT000040RelatedDocument();
relatedDocument.setTypeCode(relationType);
relatedDocument.setParentDocument(of.createPOCDMT000040ParentDocument());
relatedDocument.getParentDocument().getIds().add(of.createII());
relatedDocument.getParentDocument().getIds().get(0).setRoot(oid);
relatedDocument.getParentDocument().setCode(of.createCE());
fetchAttributes(propertycode, relatedDocument.getParentDocument().getCode());
clinicalDocument.getRelatedDocuments().add(relatedDocument);
if ( !StringUtils.isEmpty(setid) ) {
relatedDocument.getParentDocument().setSetId(of.createII());
relatedDocument.getParentDocument().getSetId().setRoot(setid);
}
}
示例4: convertStringToActionProperties
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
public static Map<String, String> convertStringToActionProperties(String text) {
PropertySplitter split = new PropertySplitter(text);
String tok = split.nextPair();
Map<String,String> props = new LinkedHashMap<String,String>();
while (tok != null) {
String[] prp = StringUtils.split(tok, "=", 2); //NOI18N
if (prp.length >= 1 ) {
String key = prp[0];
//in case the user adds -D by mistake, remove it to get a parsable xml file.
if (key.startsWith("-D")) { //NOI18N
key = key.substring("-D".length()); //NOI18N
}
if (key.startsWith("-")) { //NOI18N
key = key.substring(1);
}
if (key.endsWith("=")) {
key = key.substring(0, key.length() - 1);
}
if (key.trim().length() > 0 && Verifier.checkElementName(key.trim()) == null) {
props.put(key.trim(), prp.length > 1 ? prp[1] : "");
}
}
tok = split.nextPair();
}
return props;
}
示例5: find
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
public static @CheckForNull File[] find(@NonNull URL root, boolean javadoc) {
String k = root.toString();
Preferences n = node(javadoc);
String v = n.get(k, null);
if (v == null) {
return null;
}
String[] split = StringUtils.split(v, "||");
List<File> toRet = new ArrayList<File>();
for (String vv : split) {
File f = FileUtilities.convertStringToFile(vv);
if (f.isFile()) {
toRet.add(f);
} else {
//what do we do when one of the possibly more files is gone?
//in most cases we are dealing with exactly one file, so keep the
//previous behaviour of removing it.
n.remove(k);
}
}
return toRet.toArray(new File[0]);
}
示例6: instantiate
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
@Override
@Messages({"PRG_Dir=Creating directory", "PRG_FINISH=Finishing..."})
public Set<FileObject> instantiate (ProgressHandle handle) throws IOException {
handle.start();
try {
handle.progress(Bundle.PRG_Dir());
ProjectInfo vi = new ProjectInfo((String) wiz.getProperty("groupId"), (String) wiz.getProperty("artifactId"), (String) wiz.getProperty("version"), (String) wiz.getProperty("package")); //NOI18N
String[] splitlog = StringUtils.split(log, ":");
ArchetypeWizardUtils.logUsage(splitlog[0], splitlog[1], splitlog[2]);
File projFile = FileUtil.normalizeFile((File) wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
CreateProjectBuilder builder = createBuilder(projFile, vi, handle);
builder.create();
handle.progress(Bundle.PRG_FINISH());
return ArchetypeWizardUtils.openProjects(projFile, null);
} finally {
handle.finish();
}
}
示例7: getApplicableTokens
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
private List<Token> getApplicableTokens(Map<String, String> moduleProps, String string) {
String tokens = moduleProps.get(string);
if (tokens == null) {
return Arrays.asList(Token.values());
}
String[] split = StringUtils.split(tokens, ",");
List<Token> toRet = new ArrayList<Token>();
for (String val : split) {
try {
toRet.add(Token.valueOf(val.trim()));
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
return toRet;
}
示例8: findDependencyVersion
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
/**
* Tries to find missing version from a list of dependencies. If found, the
* artifact is updated with the correct version.
*
* @param artifact
* representing configured file.
* @param list
* list of dependencies to search.
* @param looseMatch
* only look at artifactId and groupId
* @return the found dependency
*/
private boolean findDependencyVersion( ArtifactItem artifact, List list, boolean looseMatch )
{
boolean result = false;
for ( int i = 0; i < list.size(); i++ )
{
Dependency dependency = (Dependency) list.get( i );
if ( StringUtils.equals( dependency.getArtifactId(), artifact.getArtifactId() )
&& StringUtils.equals( dependency.getGroupId(), artifact.getGroupId() )
&& ( looseMatch || StringUtils.equals( dependency.getClassifier(), artifact.getClassifier() ) )
&& ( looseMatch || StringUtils.equals( dependency.getType(), artifact.getType() ) ) )
{
artifact.setVersion( dependency.getVersion() );
result = true;
break;
}
}
return result;
}
示例9: getProcessedArtifactItems
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
protected ArrayList getProcessedArtifactItems(boolean removeVersion)
throws MojoExecutionException
{
ArrayList items = super.getProcessedArtifactItems( removeVersion );
Iterator iter = items.iterator();
while ( iter.hasNext() )
{
ArtifactItem artifactItem = (ArtifactItem) iter.next();
if ( StringUtils.isEmpty(artifactItem.getIncludes()) )
{
artifactItem.setIncludes( getIncludes() );
}
if ( StringUtils.isEmpty(artifactItem.getExcludes()) )
{
artifactItem.setExcludes( getExcludes() );
}
}
return items;
}
示例10: mergeProperties
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
protected Map<String, String> mergeProperties(Map<String, String> defaultProperties,
Map<String, String> customProperties,
boolean overrideDefaultProperties) {
if (customProperties == null) {
return defaultProperties;
}
final Map<String, String> merged = new HashMap<>();
if (overrideDefaultProperties) {
merged.putAll(defaultProperties);
merged.putAll(customProperties);
} else {
merged.putAll(customProperties);
merged.putAll(defaultProperties);
}
for (Map.Entry<String, String> entry : merged.entrySet()) {
if (StringUtils.isEmpty(entry.getValue())) {
merged.remove(entry.getKey());
}
}
return merged;
}
示例11: getAzureClient
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
public Azure getAzureClient() {
final Authenticated auth = getAuthObj();
if (auth == null) {
return null;
}
try {
final String subscriptionId = config.getSubscriptionId();
return StringUtils.isEmpty(subscriptionId) ?
auth.withDefaultSubscription() :
auth.withSubscription(subscriptionId);
} catch (Exception e) {
getLog().debug(e);
}
return null;
}
示例12: getAzureEnvironment
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
protected AzureEnvironment getAzureEnvironment(String environment) {
if (StringUtils.isEmpty(environment)) {
return AzureEnvironment.AZURE;
}
switch (environment.toUpperCase(Locale.ENGLISH)) {
case "AZURE_CHINA":
return AzureEnvironment.AZURE_CHINA;
case "AZURE_GERMANY":
return AzureEnvironment.AZURE_GERMANY;
case "AZURE_US_GOVERNMENT":
return AzureEnvironment.AZURE_US_GOVERNMENT;
default:
return AzureEnvironment.AZURE;
}
}
示例13: getAuthObjFromServerId
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
/**
* Get Authenticated object by referencing server definition in Maven settings.xml
*
* @param settings Settings object
* @param serverId Server Id to search in settings.xml
* @return Authenticated object if configurations are correct; otherwise return null.
*/
protected Authenticated getAuthObjFromServerId(final Settings settings, final String serverId) {
if (StringUtils.isEmpty(serverId)) {
getLog().debug(SERVER_ID_NOT_CONFIG);
return null;
}
final Server server = Utils.getServer(settings, serverId);
if (server == null) {
getLog().error(SERVER_ID_NOT_FOUND + serverId);
return null;
}
final ApplicationTokenCredentials credential = getAppTokenCredentialsFromServer(server);
if (credential == null) {
getLog().error(AZURE_AUTH_INVALID + serverId);
return null;
}
final Authenticated auth = azureConfigure().authenticate(credential);
if (auth != null) {
getLog().info(AUTH_WITH_SERVER_ID + serverId);
}
return auth;
}
示例14: patchStorageBinding
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
protected void patchStorageBinding(final Method method, final List<BaseBinding> bindings) {
final Optional<Annotation> storageAccount = Arrays.stream(method.getAnnotations())
.filter(a -> a instanceof StorageAccount)
.findFirst();
if (storageAccount.isPresent()) {
log.debug("StorageAccount annotation found.");
final String connectionString = ((StorageAccount) storageAccount.get()).value();
bindings.stream().forEach(b -> {
if (b instanceof StorageBaseBinding) {
final StorageBaseBinding sb = (StorageBaseBinding) b;
// Override storage bindings with empty connection
if (StringUtils.isEmpty(sb.getConnection())) {
sb.setConnection(connectionString);
}
}
});
} else {
log.debug("No StorageAccount annotation found.");
}
}
示例15: createBaseProject
import org.codehaus.plexus.util.StringUtils; //導入依賴的package包/類
/**
* Creates the base structure of the project under specified location and name
* @param projectName
* @param location
* @return
* @throws CoreException
*/
private IProject createBaseProject(String projectName, URI location) throws CoreException {
IProject newProject=null;
if(location==null){
newProject = createTheProjectAtSpecifiedLocation(projectName,location);
}
else{
IPath iPath = new Path(location.getPath());
if (!StringUtils.equals(iPath.lastSegment(), projectName)) {
iPath = iPath.append(projectName);
}
URI newLocation=URI.create(iPath.toFile().toURI().toString());
newProject= createTheProjectAtSpecifiedLocation(projectName, newLocation);
}
return newProject;
}