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

com.github.datalking.beans.BeanMetadataAttributeAccessor Maven / Gradle / Ivy

The newest version!
package com.github.datalking.beans;

import com.github.datalking.common.AttributeAccessorSupport;

/**
 * @author yaoo on 5/29/18
 */
//public class BeanMetadataAttributeAccessor extends AttributeAccessorSupport implements BeanMetadataElement {
public class BeanMetadataAttributeAccessor extends AttributeAccessorSupport {

    private Object source;

    public void setSource(Object source) {
        this.source = source;
    }

    public Object getSource() {
        return this.source;
    }

    public void addMetadataAttribute(BeanMetadataAttribute attribute) {
        super.setAttribute(attribute.getName(), attribute);
    }

    public BeanMetadataAttribute getMetadataAttribute(String name) {
        return (BeanMetadataAttribute) super.getAttribute(name);
    }

    @Override
    public void setAttribute(String name, Object value) {
        super.setAttribute(name, new BeanMetadataAttribute(name, value));
    }

    @Override
    public Object getAttribute(String name) {
        BeanMetadataAttribute attribute = (BeanMetadataAttribute) super.getAttribute(name);
        return (attribute != null ? attribute.getValue() : null);
    }

    @Override
    public Object removeAttribute(String name) {
        BeanMetadataAttribute attribute = (BeanMetadataAttribute) super.removeAttribute(name);
        return (attribute != null ? attribute.getValue() : null);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy