SCViewer/com.itjw.txviewer.database..../src/com/itjw/txviewer/database/text/TrAttrTypeFactory.groovy

27 lines
583 B
Groovy
Raw Normal View History

2012-06-17 19:53:05 +02:00
package com.itjw.txviewer.database.text
import com.itjw.txviewer.database.ITrAttrType
import com.itjw.txviewer.database.ITrAttribute
class TrAttrTypeFactory {
private static final instance = new TrAttrTypeFactory()
def attributes = [:]
private TrAttrTypeFactory() {
TrAttrTypeFactory.metaClass.constructor = {-> instance }
}
ITrAttrType getAttrType(String name, String type){
def key = name+":"+type
ITrAttrType res
if(attributes.containsKey(key)){
res=attributes[key]
} else {
res=new TrAttrType(name, type)
attributes[key]=res
}
return res
}
}