de.tsl2.nano.bean.fi.Bean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.descriptor Show documentation
Show all versions of tsl2.nano.descriptor Show documentation
TSL2 Framework Descriptor (currency-handling, generic formatter, descriptors for beans, collections, actions and values)
/*
* 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;
}
}