@Test public void applyDefaultToEntity() { EntityMappingsMocker.Default defaults = new EntityMappingsMocker.Default(); defaults.setPackageName( "org.test" ); defaults.setSchema( "schema" ); defaults.setMetadataComplete( true ); JaxbEntity entity = new JaxbEntity(); entity.setClazz( "Entity" ); DefaultConfigurationHelper.INSTANCE.applyDefaults( entity, defaults ); assertNotNull( entity.getTable() ); assertNull( entity.getTable().getSchema() ); assertNull( entity.getTable().getCatalog() ); assertTrue( entity.isMetadataComplete() ); assertEquals( "org.test.Entity", entity.getClazz() ); DefaultConfigurationHelper.INSTANCE .applyDefaults( new SchemaAware.TableSchemaAware( entity.getTable() ), defaults ); assertEquals( "schema", entity.getTable().getSchema() ); assertNull( entity.getTable().getCatalog() ); }
void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } }
DefaultConfigurationHelper { void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } } }
DefaultConfigurationHelper { void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } } private  DefaultConfigurationHelper(); }
DefaultConfigurationHelper { void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } } private  DefaultConfigurationHelper();  }
DefaultConfigurationHelper { void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } } private  DefaultConfigurationHelper();   }