本文整理匯總了Java中org.apache.commons.lang3.ObjectUtils.notEqual方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectUtils.notEqual方法的具體用法?Java ObjectUtils.notEqual怎麽用?Java ObjectUtils.notEqual使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.ObjectUtils
的用法示例。
在下文中一共展示了ObjectUtils.notEqual方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mergeUser
import org.apache.commons.lang3.ObjectUtils; //導入方法依賴的package包/類
/**
* Update internal user with the new user for following attributes :
* department and local identifier. Note the security is not checked there.
*
* @param userOrg
* The user to update. Note this must be the internal instance.
* @param newUser
* The new user data. Note this will not be the stored instance.
*/
public void mergeUser(final UserOrg userOrg, final UserOrg newUser) {
boolean needUpdate = false;
// Merge department
if (ObjectUtils.notEqual(userOrg.getDepartment(), newUser.getDepartment())) {
// Remove membership from the old department if exist
Optional.ofNullable(toDepartmentGroup(userOrg.getDepartment())).ifPresent(g -> getGroup().removeUser(userOrg, g.getId()));
// Add membership to the new department if exist
Optional.ofNullable(toDepartmentGroup(newUser.getDepartment())).ifPresent(g -> getGroup().addUser(userOrg, g.getId()));
userOrg.setDepartment(newUser.getDepartment());
needUpdate = true;
}
// Merge local identifier
if (ObjectUtils.notEqual(userOrg.getLocalId(), newUser.getLocalId())) {
userOrg.setLocalId(newUser.getLocalId());
}
// Updated as needed
if (needUpdate) {
getUser().updateUser(userOrg);
}
}
示例2: updateObject
import org.apache.commons.lang3.ObjectUtils; //導入方法依賴的package包/類
public <T> void updateObject(int id, T newData)
{
DataWatcher.WatchableObject datawatcher$watchableobject = this.getWatchedObject(id);
if (ObjectUtils.notEqual(newData, datawatcher$watchableobject.getObject()))
{
datawatcher$watchableobject.setObject(newData);
this.owner.onDataWatcherUpdate(id);
datawatcher$watchableobject.setWatched(true);
this.objectChanged = true;
}
}
示例3: validateAndGroupsCN
import org.apache.commons.lang3.ObjectUtils; //導入方法依賴的package包/類
/**
* Validate assigned groups, department and return corresponding group
* identifiers.
*
* @param userOrg
* The user to update.
* @param importEntry
* The user raw values to update.
* @param delegates
* The delegates (read/write) of the principal user.
*/
private void validateAndGroupsCN(final UserOrg userOrg, final UserOrgEditionVo importEntry, final List<DelegateOrg> delegates) {
// First complete the groups with the implicit ones from department
final String previous = Optional.ofNullable(userOrg).map(UserOrg::getDepartment).orElse(null);
if (ObjectUtils.notEqual(previous, importEntry.getDepartment())) {
Optional.ofNullable(toDepartmentGroup(previous)).map(GroupOrg::getId).ifPresent(importEntry.getGroups()::remove);
Optional.ofNullable(toDepartmentGroup(importEntry.getDepartment())).map(GroupOrg::getId)
.ifPresent(importEntry.getGroups()::add);
}
validateAndGroupsCN(Optional.ofNullable(userOrg).map(UserOrg::getGroups).orElse(Collections.emptyList()), importEntry.getGroups(),
delegates);
}
示例4: set
import org.apache.commons.lang3.ObjectUtils; //導入方法依賴的package包/類
public <T> void set(DataParameter<T> key, T value)
{
EntityDataManager.DataEntry<T> dataentry = this.<T>getEntry(key);
if (ObjectUtils.notEqual(value, dataentry.getValue()))
{
dataentry.setValue(value);
this.entity.notifyDataManagerChange(key);
dataentry.setDirty(true);
this.dirty = true;
}
}
示例5: preSend
import org.apache.commons.lang3.ObjectUtils; //導入方法依賴的package包/類
@Override
public Message< ? > preSend ( Message< ? > message , MessageChannel channel ) {
StompHeaderAccessor accessor = MessageHeaderAccessor.getAccessor( message , StompHeaderAccessor.class );
if ( ObjectUtils.notEqual( StompCommand.CONNECT , accessor.getCommand() ) ) {
return message;
}
final String authToken = accessor.getFirstNativeHeader( tokenHeader );
final String username = jwtTokenUtil.getUsernameFromToken( authToken );
LogUtils.getLogger().debug( "authToken : {},username : {}" , authToken , username );
if ( StringUtils.isEmpty( username ) ) {
throw new AuthenticationCredentialsNotFoundException( "未授權" );
}
if ( SecurityContextHolder.getContext().getAuthentication() == null ) {
// 對於簡單的驗證,隻需檢查令牌的完整性即可。 您不必強製調用數據庫。 由你自己決定
// 是否查詢數據看情況,目前是查詢數據庫
UserDetails userDetails = this.userDetailsService.loadUserByUsername( username );
if ( jwtTokenUtil.validateToken( authToken , userDetails ) ) {
UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken( userDetails , null , userDetails.getAuthorities() );
// authentication.setDetails( new WebAuthenticationDetailsSource().buildDetails( request ) );
LogUtils.getLogger().debug( "authToken : {},username : {}" , authToken , username );
LogUtils.getLogger().debug( "該 " + username + "用戶已認證WebSocket, 設置安全上下文" );
SecurityContextHolder.getContext().setAuthentication( authentication );
accessor.setUser( authentication );
}
}
if ( Objects.isNull( accessor.getUser() ) ) {
throw new AuthenticationCredentialsNotFoundException( "未授權" );
}
return message;
}
示例6: updateCompanyAsNeeded
import org.apache.commons.lang3.ObjectUtils; //導入方法依賴的package包/類
/**
* Update internal user with the new user. Note the security is not checked
* there.
*
* @param userOrg
* The internal user to update. Note this must be the internal
* instance
* @param newUser
* The new user data. Note this will not be the stored instance.
*/
private void updateCompanyAsNeeded(final UserOrg userOrg, final UserOrg newUser) {
// Check the company
if (ObjectUtils.notEqual(userOrg.getCompany(), newUser.getCompany())) {
// Move the user
getUser().move(userOrg, getCompany().findById(newUser.getCompany()));
}
}