private CreationTemplate toCreationTemplate(AttrSet t){
  Attr nameAttr=t.getAttribute(TEMPLATE_NAME);
  String name=null;
  if (nameAttr != null) {
    name=nameAttr.getValue();
  }
  Attr namingAttr=t.getAttribute(TEMPLATE_NAMINGATTRIBUTE);
  String namingAttribute=null;
  if (namingAttr != null) {
    namingAttribute=namingAttr.getValue();
  }
  Attr classAttr=t.getAttribute(TEMPLATE_JAVACLASS);
  String[] classNames=null;
  if (classAttr != null) {
    classNames=classAttr.getStringValues();
  }
  AttrSet required=decodeAttr(t.getAttribute(TEMPLATE_REQUIRED),"=");
  AttrSet optional=decodeAttr(t.getAttribute(TEMPLATE_OPTIONAL),"=");
  AttrSet validated=decodeAttr(t.getAttribute(TEMPLATE_VALIDATED),"=");
  CreationTemplate template=new CreationTemplate();
  ArrayList classes=new ArrayList();
  try {
    if (classNames != null) {
      for (int i=0; i < classNames.length; i++) {
        Class cls=Class.forName(classNames[i]);
        classes.add(cls);
      }
    }
    template=new CreationTemplate(name,required,optional,classes);
  }
 catch (  ClassNotFoundException e) {
    template=new CreationTemplate(name,required,optional);
  }
  if (validated != null) {
    template.setValidation(validated);
  }
  if (namingAttribute != null) {
    template.setNamingAttribute(namingAttribute);
  }
  return template;
}

private CreationTemplate toCreationTemplate ( AttrSet t ) { Attr nameAttr = t . getAttribute ( TEMPLATE_NAME ) ; String name = null ; if ( nameAttr != null ) { name = nameAttr . getValue ( ) ; } Attr namingAttr = t . getAttribute ( TEMPLATE_NAMINGATTRIBUTE ) ; String namingAttribute = null ; if ( namingAttr != null ) { namingAttribute = namingAttr . getValue ( ) ; } Attr classAttr = t . getAttribute ( TEMPLATE_JAVACLASS ) ; String [ ] classNames = null ; if ( classAttr != null ) { classNames = classAttr . getStringValues ( ) ; } AttrSet required = decodeAttr ( t . getAttribute ( TEMPLATE_REQUIRED ) , "=" ) ; AttrSet optional = decodeAttr ( t . getAttribute ( TEMPLATE_OPTIONAL ) , "=" ) ; AttrSet validated = decodeAttr ( t . getAttribute ( TEMPLATE_VALIDATED ) , "=" ) ; CreationTemplate template = new CreationTemplate ( ) ; ArrayList classes = new ArrayList ( ) ; try { if ( classNames != null ) { for ( int i = 0 ; i < classNames . length ; i ++ ) { Class cls = Class . forName ( classNames [ i ] ) ; classes . add ( cls ) ; } } template = new CreationTemplate ( name , required , optional , classes ) ; } catch ( ClassNotFoundException e ) { template = new CreationTemplate ( name , required , optional ) ; } if ( validated != null ) { template . setValidation ( validated ) ; } if ( namingAttribute != null ) { template . setNamingAttribute ( namingAttribute ) ; } return template ; }
reads in a attribute set and converts name - value pairs to a creationtemplate object .
