Used switch case in place of if else if
This commit is contained in:
parent
d780357089
commit
1e02edd42c
|
@ -421,16 +421,24 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
|
||||
ERManagement<? extends OElement> erManagement = null;
|
||||
|
||||
if(Resource.class.isAssignableFrom(accessType.getTypeClass())) {
|
||||
erManagement = new ResourceTypeDefinitionManagement();
|
||||
}else if(Facet.class.isAssignableFrom(accessType.getTypeClass())) {
|
||||
erManagement = new FacetTypeDefinitionManagement();
|
||||
} else if(IsRelatedTo.class.isAssignableFrom(accessType.getTypeClass())) {
|
||||
erManagement = new IsRelatedToTypeDefinitionManagement();
|
||||
} else if(ConsistsOf.class.isAssignableFrom(accessType.getTypeClass())) {
|
||||
erManagement = new ConsistsOfTypeDefinitionManagement();
|
||||
} else if(Property.class.isAssignableFrom(accessType.getTypeClass())) {
|
||||
switch(accessType) {
|
||||
case PROPERTY:
|
||||
erManagement = new PropertyTypeDefinitionManagement();
|
||||
break;
|
||||
case RESOURCE:
|
||||
erManagement = new ResourceTypeDefinitionManagement();
|
||||
break;
|
||||
case FACET:
|
||||
erManagement = new FacetTypeDefinitionManagement();
|
||||
break;
|
||||
case IS_RELATED_TO:
|
||||
erManagement = new IsRelatedToTypeDefinitionManagement();
|
||||
break;
|
||||
case CONSISTS_OF:
|
||||
erManagement = new ConsistsOfTypeDefinitionManagement();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
String ret = null;
|
||||
|
|
|
@ -191,8 +191,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
}
|
||||
|
||||
//@Test(expected=SchemaAlreadyPresentException.class)
|
||||
@Test
|
||||
@Test(expected=SchemaAlreadyPresentException.class)
|
||||
public void createPropertyType() throws Exception {
|
||||
PropertyTypeDefinition<ValueSchema> propertyTypeDefinition = new PropertyTypeDefinitionImpl<>(ValueSchema.class);
|
||||
|
||||
|
|
Loading…
Reference in New Issue