All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.memority.domino.shared.api.context.HasAttributeValueHelperTodoDuplicateClass Maven / Gradle / Ivy

Go to download

This artifact provides the API classes that are necessary to implement synchronization configuration Rules on the Memority IM platform.

There is a newer version: 3.43.1
Show newest version
/*
 * Copyright (c) 2016-2023 Memority. All Rights Reserved.
 *
 * This file is part of Memority Domino API , a Memority project.
 *
 * This file is released under the Memority Public Artifacts End-User License Agreement,
 * see 
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 */
package com.memority.domino.shared.api.context;

import com.memority.citadel.shared.api.im.AttributeValue;
import com.memority.citadel.shared.api.im.HasAttributeValues;

import java.util.Collections;

/**
 * Helper methods to keep {@link HasAttributeValues} & co clean.
 */
class HasAttributeValueHelperTodoDuplicateClass {

    private HasAttributeValueHelperTodoDuplicateClass() {
    }

    @SuppressWarnings("unchecked")
    static  V doGet(HasAttributeValues obj, String propertyName) {
        AttributeValue attributeValue = obj.attributeValueMap().get(propertyName);

        // Missing/empty attribute
        if (attributeValue == null) {
            return null;
        }

        if (!attributeValue.hasValue()) {
            return attributeValue.isMultiValued() ? (V) Collections.emptyList() : null;
        }

        return attributeValue.isMultiValued() ?
               (V) obj.values(propertyName) :
               (V) obj.value(propertyName);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy