@Test public void addType() { SidoContext context = mock(SidoContext.class); DefaultSidoSchema schema = new DefaultSidoSchema(context, UID); SidoType type = mock(SidoType.class); when(type.getName()).thenReturn("Person"); schema.addType(type); assertSame(type, schema.getType("Person", true)); }
protected JClass createClass(GenerationContext generationContext, SidoType type) { JClass c = JClassUtils.createClassRef(generationContext, type); // Abstraction? if (type.isAbstractType()) { c.setAbstractClass(true); } // Subclass? SidoType parentType = type.getParentType(); if (parentType != null) { String parentTypeName = JClassUtils.getSimpleClassName(generationContext, parentType); c.setParent(parentTypeName); c.addImport(JClassUtils.createClassRef(generationContext, parentType)); } // Constructors generateConstructors(c, generationContext, type); // OK return c; }
/** Generation of members for all properties */ protected void generateProperties(JClass c, GenerationContext generationContext, SidoType type) { Collection<SidoProperty> properties = type.getProperties(); for (SidoProperty property : properties) { generateProperty(property, c, generationContext, type); } }