public void setReference(String name, int type , String reference, String key) {
        if ((type != ElementType.TYPE_REFERENCE) && (type != ElementType.TYPE_REFERENCE_ARRAY) && (type != ElementType.TYPE_BACK_REFERENCE)) {
            throw new RuntimeException("Illegal type: " + type);
        }
        types.put(name,new ElementType(name,type,reference,key));
    }