private Vector<ClassAttributes> getClassAttributes(Model model, Class<?> baseClass) { Vector<ClassAttributes> attributes = decomposedClassesCache.get(baseClass); if (attributes == null) { LOG.info("decomposedClassesCache: No entry for " + baseClass + ", adding..."); attributes = new Vector<ClassAttributes>(); for (Class<?> cls : Util.decomposeClass(baseClass)) { ClassDescriptor cld = model.getClassDescriptorByName(cls.getName()); attributes.add(new ClassAttributes(cld.getUnqualifiedName(), cld .getAllAttributeDescriptors())); } decomposedClassesCache.put(baseClass, attributes); } return attributes; }
private Vector<ClassAttributes> getClassAttributes(Model model, Class<?> baseClass) { Vector<ClassAttributes> attributes = decomposedClassesCache.get(baseClass); if (attributes == null) { LOG.info("decomposedClassesCache: No entry for " + baseClass + ", adding..."); attributes = new Vector<ClassAttributes>(); for (Class<?> cls : Util.decomposeClass(baseClass)) { ClassDescriptor cld = model.getClassDescriptorByName(cls.getName()); attributes.add(new ClassAttributes(cld.getUnqualifiedName(), cld .getAllAttributeDescriptors())); } decomposedClassesCache.put(baseClass, attributes); } return attributes; }
addFields(sb, getAllAttributeDescriptors()); sb.append("},\"references\":{"); addFields(sb, getAllReferenceDescriptors());
addFields(sb, getAllAttributeDescriptors()); sb.append("},\"references\":{"); addFields(sb, getAllReferenceDescriptors());
StringBuffer sb = new StringBuffer("CREATE TABLE " + DatabaseUtil.getTableName(cd) + " ("); boolean needsComma = false; for (AttributeDescriptor ad: cd.getAllAttributeDescriptors()) { if (needsComma) { sb.append(",");
StringBuffer sb = new StringBuffer("CREATE TABLE " + DatabaseUtil.getTableName(cd) + " ("); boolean needsComma = false; for (AttributeDescriptor ad: cd.getAllAttributeDescriptors()) { if (needsComma) { sb.append(",");
classData.put("references", refs); classData.put("collections", colls); for (AttributeDescriptor a: cld.getAllAttributeDescriptors()) { Map<String, Object> attr = new HashMap<String, Object>(); attrs.put(a.getName(), attr);
classData.put("references", refs); classData.put("collections", colls); for (AttributeDescriptor a: cld.getAllAttributeDescriptors()) { Map<String, Object> attr = new HashMap<String, Object>(); attrs.put(a.getName(), attr);
for (AttributeDescriptor att : cld.getAllAttributeDescriptors()) { if ("id".equals(att.getName())) { continue;
for (AttributeDescriptor att : cld.getAllAttributeDescriptors()) { if ("id".equals(att.getName())) { continue;
for (AttributeDescriptor att : cld.getAllAttributeDescriptors()) { String fieldName = att.getName(); if ("id".equals(fieldName)) {
for (AttributeDescriptor att : cld.getAllAttributeDescriptors()) { String fieldName = att.getName(); if ("id".equals(fieldName)) {
public void testGetAllAttributeDescriptors() throws Exception { // three superclass levels with one attribute each, getAllAttributeDescriptors on cld3 should return all 3 AttributeDescriptor atb1 = new AttributeDescriptor("att1", "java.lang.String"); ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, Collections.singleton(atb1), noRefs, noColls); AttributeDescriptor atb2 = new AttributeDescriptor("att2", "java.lang.String"); ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", "package.name.Class1", false, Collections.singleton(atb2), noRefs, noColls); AttributeDescriptor atb3 = new AttributeDescriptor("att3", "java.lang.String"); ClassDescriptor cld3 = new ClassDescriptor("package.name.Class3", "package.name.Class2", false, Collections.singleton(atb3), noRefs, noColls); new Model("test", "package.name", Arrays.asList(cld1, cld2, cld3)); FieldDescriptor id = cld3.getFieldDescriptorByName("id"); Set<FieldDescriptor> atts = new HashSet<FieldDescriptor>(Arrays.asList(atb3, atb2, atb1, id)); assertEquals(atts, cld3.getAllAttributeDescriptors()); }
TextTable table = new TextTable(true, true, true); table.addRow(TextTable.ROW_SEPARATOR); for (AttributeDescriptor desc : getAllAttributeDescriptors()) { ClassDescriptor cld = desc.getClassDescriptor(); table.addRow(new String[] {desc.getName(), terseClass(desc.getType()),
TextTable table = new TextTable(true, true, true); table.addRow(TextTable.ROW_SEPARATOR); for (AttributeDescriptor desc : getAllAttributeDescriptors()) { ClassDescriptor cld = desc.getClassDescriptor(); table.addRow(new String[] {desc.getName(), terseClass(desc.getType()),