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

de.tsl2.nano.bean.fi.Bean Maven / Gradle / Ivy

Go to download

TSL2 Framework Descriptor (currency-handling, generic formatter, descriptors for beans, collections, actions and values)

There is a newer version: 2.5.1
Show newest version
/*
 * File: $HeadURL$
 * Id  : $Id$
 * 
 * created by: Thomas Schneider
 * created on: Jun 29, 2012
 * 
 * Copyright: (c) Thomas Schneider 2012, all rights reserved
 */
package de.tsl2.nano.bean.fi;

import java.text.Format;

import de.tsl2.nano.bean.def.AttributeDefinition;
import de.tsl2.nano.bean.def.Presentable;


/**
 * 
 * @author Thomas Schneider
 * @version $Revision$ 
 */
public class Bean extends de.tsl2.nano.bean.def.Bean {
    /** serialVersionUID */
    private static final long serialVersionUID = 1L;
    AttributeDefinition attrOnConstruction;
    
    /**
     * constructor
     */
    public Bean() {
        super();
    }

    /**
     * constructor
     * @param instance
     */
    public Bean(T instance) {
        super(instance);
    }

    public  Bean add(String name, V value) {
        attrOnConstruction = addAttribute(name, value, null, name, null);
        return this;
    }
    
    public Bean constrain(int length, Format format, boolean nullable) {
        attrOnConstruction.setBasicDef(length, nullable, format, null, attrOnConstruction.getDescription());
        return this;
    }
    public Bean description(Presentable p) {
        attrOnConstruction.setPresentation(p);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy