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


Java ObjectUtils.notEqual方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:ligoj,項目名稱:plugin-id,代碼行數:35,代碼來源:UserOrgResource.java

示例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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:13,代碼來源:DataWatcher.java

示例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);
}
 
開發者ID:ligoj,項目名稱:plugin-id,代碼行數:24,代碼來源:UserOrgResource.java

示例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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:EntityDataManager.java

示例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;
}
 
開發者ID:yujunhao8831,項目名稱:spring-boot-start-current,代碼行數:44,代碼來源:JwtWebSocketInterceptorAdapter.java

示例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()));
	}
}
 
開發者ID:ligoj,項目名稱:plugin-id,代碼行數:18,代碼來源:UserOrgResource.java


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