2010年3月14日日曜日

Apex Describe Information

// Create a new account as the generic type sObject

sObject s = new Account();

// Verify that the generic sObject is an Account sObject

System.assert(s.getsObjectType() == Account.sObjectType);

// Get the sObject describe result for the Account object

Schema.DescribeSObjectResult r = Account.sObjectType.getDescribe();

// Get the field describe result for the Name field on the Account object

Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.Name;

// Verify that the field token is the token for the Name field on an Account object

System.assert(f.getSObjectField() == Account.Name);

// Get the field describe result from the token

f = f.getSObjectField().getDescribe();

0 件のコメント:

コメントを投稿