Tests if a bean is capable of having its state temporarily stored to secondary storage

@param bean The bean to inspect
@return True if the bean is passivation capable
425160
public static boolean isPassivationCapableDependency(Bean<?> bean) {
        if (bean instanceof RIBean<?>) {
            return ((RIBean<?>) bean).isPassivationCapableDependency();
        }
        return bean instanceof PassivationCapable;
    }
1332877
protected boolean syncCheckLoginSessionIfNeeds(USER_BEAN userBean) {
        if (!(userBean instanceof SyncCheckable)) {
            return true; // means no check
        }
        final SyncCheckable checkable = (SyncCheckable) userBean;
        final OptionalThing<LocalDateTime> checkDt = checkable.getLastestSyncCheckTime(); // might be null
        final LocalDateTime currentDt = timeManager.currentDateTime();
        if (!needsLoginSessionSyncCheck(userBean, checkDt, currentDt)) {
            return true; // means no check
        }
        if (logger.isDebugEnabled()) {
            final ID userId = userBean.getUserId();
            final String checkDisp = checkDt.map(dt -> new HandyDate(dt).toDisp("yyyy/MM/dd HH:mm:ss")).orElse(null);
            logger.debug("...Sync-checking login session: userId={}, checkDate={}", userId, checkDisp);
        }
        checkable.manageLastestSyncCheckTime(currentDt); // update latest check date
        return findLoginSessionSyncCheckUser(userBean).map(loginUser -> {
            handleLoginSessionSyncCheckSuccess(userBean, loginUser);
            return true;
        }).orElseGet(() -> { // the user might be assigned here
            logger.debug("*The user already cannot login: {}", userBean);
            logout(); // remove user info from session
            return false; // means check NG
        });
    }
1106825
public static <T> T cloneBean(final Object bean) {
		try {
			return (T) BeanUtils.cloneBean(bean);
		} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
			throw new RuntimeException(e);
		}
	}
922
@Override
  public boolean delete(Object bean) throws OptimisticLockException {
    methodCalls.add(MethodCall.of("bean").with("bean", bean));
    capturedBeans.addDeleted(bean);
    if (persistDeletes) {
      return delete.delete(bean, null);
    }
    return true;
  }
984636
public <T> T toBeanWithCamelCase(T bean) {
		BeanUtil.fillBeanWithMap(this, bean, true, false);
		return bean;
	}
1354425
public static <T extends BaseEntity> void removeCache(T bean){
		if(CacheHandler.cacheProvider == null)return;
		String key = buildCacheKey(bean.getClass(), bean.getId());
		CacheHandler.cacheProvider.remove(key);
	}
355650
public void finalSweep(StatefulPassivator passivator) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "finalSweep : Stateful Beans = " + ivStatefulBeanList.size());

        for (Enumeration<TimeoutElement> e = ivStatefulBeanList.elements(); e.hasMoreElements();) {
            TimeoutElement elt = e.nextElement();

            if (elt.passivated) {
                try {
                    // If the bean hasn't already been removed (possibly by the
                    // regular sweep(), then go ahead and remove the file. d129562
                    if (remove(elt.beanId)) {
                        passivator.remove(elt.beanId, false); //LIDB2018-1
                    }

                } catch (RemoteException ex) {
                    FFDCFilter.processException(ex, CLASS_NAME + ".finalSweep",
                                                "298", this);
                    Tr.warning(tc, "REMOVE_FROM_PASSIVATION_STORE_FAILED_CNTR0016W", new Object[] { elt.beanId, ex }); //p111002.3
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "finalSweep : Stateful Beans = " + ivStatefulBeanList.size());
    }
747179
public boolean destroy(Contextual bean)
    {
        ContextualStorage storage = getContextualStorage(false);
        if (storage == null)
        {
            return false;
        }
        ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));

        if (contextualInstanceInfo == null)
        {
            return false;
        }

        bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());

        return true;
    }
582050
public static void validateSchema(Bean bean) {
        validateId(bean);
        validatePropertyNames(bean);
        validateReferences(bean);
        validateProperties(bean);
        validatePropertyList(bean);
        validatePropertyReferences(bean);
        validatePropertyRefList(bean);
        validatePropertyRefMap(bean);
    }
918399
public static List<String> getFindedAllSensitive(Object bean){
		return sensitiveTree.matchAll(JSONUtil.toJsonStr(bean));
	}
434879
public static boolean isFileMapped(ByteBuffer bb) {
        if (bb instanceof MappedByteBuffer) {
            try {
                ((MappedByteBuffer) bb).isLoaded();
                return true;
            } catch (UnsupportedOperationException ex) {
            }
        }
        return false;
    }
438843
@Override
    public void internalInitialize(BeanDeployerEnvironment environment) {
        getDeclaringBean().initialize(environment);
        super.internalInitialize(environment);
        initPassivationCapable();
    }
1343086
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof ApplicationWindowAware) {
            ((ApplicationWindowAware)bean).setApplicationWindow(window);
        }
        return bean;
    }
10936
private boolean isCDIEnabled(WebSphereBeanDeploymentArchive bda) {
        Boolean hasBeans = cdiStatusMap.get(bda.getId());
        if (hasBeans == null) {
            //it's enabled if it has beans or it is an extension which could add beans
            hasBeans = bda.hasBeans() || bda.isExtension();
            //setting this now should prevent loops when checking children in the next step
            cdiStatusMap.put(bda.getId(), hasBeans);

            //it's also enabled if any of it's children are enabled (but not including runtime extensions)
            hasBeans = hasBeans || isCDIEnabled(bda.getWebSphereBeanDeploymentArchives());
            //remember the result
            cdiStatusMap.put(bda.getId(), hasBeans);
        }

        return hasBeans;
    }
612184
public Map<String, Object> write(Bean bean) {
        JodaBeanUtils.notNull(bean, "bean");
        return writeBean(bean, bean.getClass());
    }
835446
@Override
    @SuppressWarnings("unchecked")
    public <T> T get(Contextual<T> contextual) {
        Bean bean = (Bean) contextual;
        // you can store the bean somewhere
        if (somewhere.containsKey(bean.getName())) {
            return (T) somewhere.get(bean.getName());
        } else {
            return null;
        }
    }
1258732
public Bean<T> create() {
        if (!passivationCapable) {
            return new ImmutableBean<T>(beanClass, name, qualifiers, scope, stereotypes, types, alternative, nullable, injectionPoints, beanLifecycle, toString);
        } else {
            return new ImmutablePassivationCapableBean<T>(id, beanClass, name, qualifiers, scope, stereotypes, types, alternative, nullable, injectionPoints, beanLifecycle, toString);
        }
    }