How to differentiate LIST apart from HIERARCHY setting in Apex?

Just found an angle. Starting with the API name:

String api = 'MyCustomSetting__c';

bit of jiggery pokery...

//dynamic object info
Type reflector = Type.forName(api);
SObject sobj = (SObject)reflector.newInstance();
DescribeSObjectResult sobjResult = sobj.getSObjectType().getDescribe();

//some Name field info
SObjectField field = sobjResult.Fields.getMap().get('Name');
DescribeFieldResult fieldResult = field.getDescribe();
Integer length = fieldResult.getLength();

...results seem conclusive enough:

if (length == 38) {
    //it's a list!
} else if (length == 80) {
    //it's a hierarchy!
}

(The length of the Name field differs)


Or also, the hierarchy custom setting will have at least one record where the SetupOwnerId is the company Id

SetupOwnerId = Userinfo.getOrganizationId()