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