當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.equals方法代碼示例

本文整理匯總了Java中org.apache.commons.codec.binary.StringUtils.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.equals方法的具體用法?Java StringUtils.equals怎麽用?Java StringUtils.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.codec.binary.StringUtils的用法示例。


在下文中一共展示了StringUtils.equals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: authenticateUsernamePasswordInternal

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential,
                                                             final String originalPassword)
        throws GeneralSecurityException, PreventedException {
    if (this.users == null || this.users.isEmpty()) {
        throw new FailedLoginException("No user can be accepted because none is defined");
    }
    final String username = credential.getUsername();
    final String cachedPassword = this.users.get(username);

    if (cachedPassword == null) {
        LOGGER.debug("[{}] was not found in the map.", username);
        throw new AccountNotFoundException(username + " not found in backing map.");
    }

    if (!StringUtils.equals(credential.getPassword(), cachedPassword)) {
        throw new FailedLoginException();
    }
    final List<MessageDescriptor> list = new ArrayList<>();
    return createHandlerResult(credential, this.principalFactory.createPrincipal(username), list);
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:22,代碼來源:AcceptUsersAuthenticationHandler.java

示例2: move

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
@Override
public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException {
    try {
        if(status.isExists()) {
            delete.delete(Collections.singletonList(renamed), connectionCallback, callback);
        }
        final String fileid = new DriveFileidProvider(session).getFileid(file, new DisabledListProgressListener());
        if(!StringUtils.equals(file.getName(), renamed.getName())) {
            // Rename title
            final File properties = new File();
            properties.setName(renamed.getName());
            properties.setMimeType(status.getMime());
            session.getClient().files().update(fileid, properties).
                setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
        }
        // Retrieve the existing parents to remove
        final StringBuilder previousParents = new StringBuilder();
        final File reference = session.getClient().files().get(fileid)
            .setFields("parents")
            .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable"))
            .execute();
        for(String parent : reference.getParents()) {
            previousParents.append(parent);
            previousParents.append(',');
        }
        // Move the file to the new folder
        session.getClient().files().update(fileid, null)
            .setAddParents(new DriveFileidProvider(session).getFileid(renamed.getParent(), new DisabledListProgressListener()))
            .setRemoveParents(previousParents.toString())
            .setFields("id, parents")
            .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable"))
            .execute();
        return new Path(renamed.getParent(), renamed.getName(), renamed.getType(),
            new PathAttributes(renamed.attributes()).withVersionId(fileid));
    }
    catch(IOException e) {
        throw new DriveExceptionMappingService().map("Cannot rename {0}", e, file);
    }
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:40,代碼來源:DriveMoveFeature.java

示例3: update

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.PUT)
public MediaMetadataDto update(@RequestBody MediaMetadataDto mediaMetadataDto) {
    MediaMetadata mediaMetadataFromDb;
    if (mediaMetadataDto.getUuid() == null || (mediaMetadataFromDb = mediaService.get(mediaMetadataDto.getUuid())) == null) {
        throw new ResourceNotFoundException("A valid uuid is required to edit a bundle.");
    }

    // Check Validation of MediaMetadataDto
    validator.validate(mediaMetadataDto, null);

    // Additionnal Validations
    if (MediaMetadata.hasFile(mediaMetadataDto.getMediaType())
            && !StringUtils.equals(mediaMetadataFromDb.getUrl(), mediaMetadataDto.getUrl())) {
        throw new IllegalArgumentException("You can set the URL if the media has a file.");
    }

    // Mapper
    MediaMetadata meta = mapper.fromDto(mediaMetadataDto);

    // Save or update media
    Media media = Media
            .builder()
            .metadata(meta)
            .build();

    mediaService.update(media);

    // Get generated Uuid
    mediaMetadataDto.setUuid(media.getMetadata().getUuid());

    return mediaMetadataDto;
}
 
開發者ID:resourcepool,項目名稱:dashboard,代碼行數:33,代碼來源:MediaController.java

示例4: checkLeadingWhitespaces

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
public void checkLeadingWhitespaces(String sourceContent, String targetContent) throws WhitespaceIntegrityCheckerException {
    logger.debug("Get leading whitespaces around the source");
    String sourceWhiteSpaces = getLeadingWhitespaces(sourceContent);
    logger.debug("Source leading whitespaces: {}", sourceWhiteSpaces);

    logger.debug("Get leading whitespaces around the target");
    String targetWhiteSpaces = getLeadingWhitespaces(targetContent);
    logger.debug("Target leading whitespaces: {}", targetWhiteSpaces);

    logger.debug("Make sure the target has the same leading whitespaces as the source");
    if (!StringUtils.equals(sourceWhiteSpaces, targetWhiteSpaces)) {
        throw new WhitespaceIntegrityCheckerException("Leading whitespaces around source and target are different");
    }
}
 
開發者ID:box,項目名稱:mojito,代碼行數:15,代碼來源:WhitespaceIntegrityChecker.java

示例5: checkTrailingWhitespaces

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
public void checkTrailingWhitespaces(String sourceContent, String targetContent) throws WhitespaceIntegrityCheckerException {
    logger.debug("Get trailing whitespaces around the source");
    String sourceWhiteSpaces = getTrailingWhitespaces(sourceContent);
    logger.debug("Source trailing whitespaces: {}", sourceWhiteSpaces);

    logger.debug("Get trailing whitespaces around the target");
    String targetWhiteSpaces = getTrailingWhitespaces(targetContent);
    logger.debug("Target trailing whitespaces: {}", targetWhiteSpaces);

    logger.debug("Make sure the target has the same trailing whitespaces as the source");
    if (!StringUtils.equals(sourceWhiteSpaces, targetWhiteSpaces)) {
        throw new WhitespaceIntegrityCheckerException("Trailing shitespaces around source and target are different");
    }
}
 
開發者ID:box,項目名稱:mojito,代碼行數:15,代碼來源:WhitespaceIntegrityChecker.java

示例6: equals

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
@Override
public boolean equals(Object obj) {
	if(!(obj instanceof PageUploadDescriptor)) {
		logger.debug("Type is different");
		return false;
	}
	PageUploadDescriptor p = (PageUploadDescriptor)obj;
	if(!StringUtils.equals(this.fileName, p.getFileName())){
		logger.debug("IMG filename is different");
		return false;
	}
	if(!StringUtils.equals(this.pageXmlName, p.getPageXmlName())){
		logger.debug("XML filename is different");
		return false;
	}
	if(this.pageNr != p.getPageNr()) {
		return false;
	}
	if(!StringUtils.equals(this.imgChecksum, p.getImgChecksum())){
		logger.debug("IMG checksum is different");
		return false;
	}
	if(!StringUtils.equals(this.pageXmlChecksum, p.getPageXmlChecksum())){
		logger.debug("XML checksum is different");
		return false;
	}
	return true;
}
 
開發者ID:Transkribus,項目名稱:TranskribusCore,代碼行數:29,代碼來源:DocumentUploadDescriptor.java

示例7: hasSameParent

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
private static boolean hasSameParent(ITrpShapeType st, String parentId) {
	ITrpShapeType parent = TrpShapeTypeUtils.getParentShape(st);
	if (parent != null) {
		return StringUtils.equals(parentId, parent.getId());
	}
	
	return false;
}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:9,代碼來源:StructureTreeDropAdapter.java

示例8: getPostActionParameter

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
private PostActionParameterObject getPostActionParameter(String objectId, String objectKey) {
    for (PostActionParameterObject postActionParameterObject : postActionParameters) {

        if (StringUtils.equals(postActionParameterObject.getObjectId(), objectId) &&
                StringUtils.equals(postActionParameterObject.getObjectKey(), objectKey)) {
            return postActionParameterObject;
        }
    }
    return null;
}
 
開發者ID:motech,項目名稱:motech,代碼行數:11,代碼來源:TaskContext.java

示例9: setId

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
public void setId(final String id) {
    if (StringUtils.equals(this.id, id)) {
        return;
    }

    this.id = id;
    kvClient.putValue(config.getClusterId() + "/Node/" + id + '/');
}
 
開發者ID:nano-projects,項目名稱:nano-framework,代碼行數:9,代碼來源:Node.java

示例10: setHost

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
public void setHost(final String host) {
    if (StringUtils.equals(this.host, host)) {
        return;
    }

    this.host = host;
    kvClient.putValue(config.getClusterId() + "/Node/" + id + "/host", host);
}
 
開發者ID:nano-projects,項目名稱:nano-framework,代碼行數:9,代碼來源:Node.java

示例11: setUptime

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
public void setUptime(final Long uptime) {
    if (StringUtils.equals(String.valueOf(this.uptime), String.valueOf(uptime))) {
        return;
    }

    this.uptime = uptime;
    kvClient.putValue(config.getClusterId() + "/Node/" + id + "/uptime", String.valueOf(uptime));
}
 
開發者ID:nano-projects,項目名稱:nano-framework,代碼行數:9,代碼來源:Node.java

示例12: setLivetime

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
public void setLivetime(final Long livetime) {
    if (StringUtils.equals(String.valueOf(this.livetime), String.valueOf(livetime))) {
        return;
    }

    this.livetime = livetime;
    kvClient.putValue(config.getClusterId() + "/Node/" + id + "/livetime", String.valueOf(livetime));
}
 
開發者ID:nano-projects,項目名稱:nano-framework,代碼行數:9,代碼來源:Node.java

示例13: validateCodeIsInContains

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
private ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult validateCodeIsInContains(List<ValueSetExpansionContainsComponent> contains, String theSystem, String theCode,
		Coding theCoding, CodeableConcept theCodeableConcept) {
	for (ValueSetExpansionContainsComponent nextCode : contains) {
		ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult result = validateCodeIsInContains(nextCode.getContains(), theSystem, theCode, theCoding, theCodeableConcept);
		if (result != null) {
			return result;
		}

		String system = nextCode.getSystem();
		String code = nextCode.getCode();

		if (isNotBlank(theCode)) {
			if (theCode.equals(code) && (isBlank(theSystem) || theSystem.equals(system))) {
				return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
			}
		} else if (theCoding != null) {
			if (StringUtils.equals(system, theCoding.getSystem()) && StringUtils.equals(code, theCoding.getCode())) {
				return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
			}
		} else {
			for (Coding next : theCodeableConcept.getCoding()) {
				if (StringUtils.equals(system, next.getSystem()) && StringUtils.equals(code, next.getCode())) {
					return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
				}
			}
		}

	}

	return null;
}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:32,代碼來源:FhirResourceDaoValueSetDstu3.java

示例14: validateCodeIsInContains

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
private ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult validateCodeIsInContains(List<ExpansionContains> contains, String theSystem, String theCode, CodingDt theCoding,
		CodeableConceptDt theCodeableConcept) {
	for (ExpansionContains nextCode : contains) {
		ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult result = validateCodeIsInContains(nextCode.getContains(), theSystem, theCode, theCoding, theCodeableConcept);
		if (result != null) {
			return result;
		}

		String system = nextCode.getSystem();
		String code = nextCode.getCode();

		if (isNotBlank(theCode)) {
			if (theCode.equals(code) && (isBlank(theSystem) || theSystem.equals(system))) {
				return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
			}
		} else if (theCoding != null) {
			if (StringUtils.equals(system, theCoding.getSystem()) && StringUtils.equals(code, theCoding.getCode())) {
				return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
			}
		} else {
			for (CodingDt next : theCodeableConcept.getCoding()) {
				if (StringUtils.equals(system, next.getSystem()) && StringUtils.equals(code, next.getCode())) {
					return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
				}
			}
		}

	}

	return null;
}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:32,代碼來源:FhirResourceDaoValueSetDstu2.java

示例15: matches

import org.apache.commons.codec.binary.StringUtils; //導入方法依賴的package包/類
@Override
public boolean matches(final String s, final String s1) {
    return StringUtils.equals(s, s1);
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:5,代碼來源:MongoAuthenticationHandler.java


注:本文中的org.apache.commons.codec.binary.StringUtils.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。