get fields from salesforce apex code example
Example: apex get object fields
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.<Object API Name>.fields.getMap();
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.<Object API Name>.fields.getMap();