Attribute.java 1.44 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.granite.auth.saml.model;

import java.util.ArrayList;
import java.util.List;

public class Attribute {
    private String name;
    private String nameFormat;
    private Object attributeValue;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNameFormat() {
        return this.nameFormat;
    }

    public void setNameFormat(String nameFormat) {
        this.nameFormat = nameFormat;
    }

    public void addAttributeValue(Object value) {
        if (null == this.attributeValue) {
            this.attributeValue = value;
        } else if (this.attributeValue instanceof List) {
            ((List)this.attributeValue).add(value);
        } else {
            Object oldValue = this.attributeValue;
            ArrayList<Object> newValue = new ArrayList<Object>();
            newValue.add(oldValue);
            newValue.add(value);
            this.attributeValue = newValue;
        }
    }

    public Object getValue() {
        return this.attributeValue;
    }

    public List<Object> getListValue() {
        ArrayList<Object> result;
        if (this.attributeValue instanceof List) {
            result = (ArrayList<Object>)this.attributeValue;
        } else {
            result = new ArrayList<Object>();
            result.add(this.attributeValue);
        }
        return result;
    }
}