没有合适的资源?快使用搜索试试~ 我知道了~
首页salesforce_apex_language_reference.pdf
salesforce_apex_language_reference.pdf
需积分: 9 17 下载量 77 浏览量
更新于2023-06-04
评论
收藏 4.56MB PDF 举报
salesforce_apex_language_reference.pdf,Apex语言开发手册,英文版
资源详情
资源评论
资源推荐
salesforce: Winter '12
Force.com Apex Code Developer's Guide
Last updated: October 29, 2011
©
Copyright 2000–2011 salesforce.com, inc. All rights reserved. Salesforce.com is a registered trademark of salesforce.com, inc., as are other
names and marks. Other marks appearing herein may be trademarks of their respective owners.
Table of Contents
Chapter 1: Introducing Apex...............................................................................................................11
What is Apex?.........................................................................................................................................................................12
How Does Apex Work?..............................................................................................................................................13
What is the Apex Development Process?....................................................................................................................14
Using a Developer or Sandbox Organization...................................................................................................14
Learning Apex.................................................................................................................................................17
Writing Apex...................................................................................................................................................18
Writing Tests...................................................................................................................................................19
Deploying Apex to a Sandbox Organization...................................................................................................19
Deploying Apex to a Salesforce Production Organization...............................................................................20
Adding Apex Code to a Force.com AppExchange App..................................................................................20
When Should I Use Apex?..........................................................................................................................................20
What are the Limitations of Apex?.............................................................................................................................21
What's New?...........................................................................................................................................................................22
Apex Quick Start.....................................................................................................................................................................22
Documentation Typographical Conventions...............................................................................................................22
Understanding Apex Core Concepts...........................................................................................................................23
Writing Your First Apex Class and Trigger................................................................................................................27
Creating a Custom Object...............................................................................................................................28
Adding an Apex Class.....................................................................................................................................28
Adding an Apex Trigger..................................................................................................................................29
Adding a Test Class.........................................................................................................................................31
Deploying Components to Production............................................................................................................33
Chapter 2: Language Constructs.........................................................................................................34
Data Types..............................................................................................................................................................................35
Primitive Data Types...................................................................................................................................................35
sObject Types..............................................................................................................................................................38
Accessing sObject Fields..................................................................................................................................39
Accessing sObject Fields Through Relationships............................................................................................40
Validating sObjects and Fields .......................................................................................................................41
Collections...................................................................................................................................................................42
Lists.................................................................................................................................................................42
Sets..................................................................................................................................................................44
Maps................................................................................................................................................................45
Maps from SObject Arrays..............................................................................................................................46
Iterating Collections........................................................................................................................................46
Enums.........................................................................................................................................................................46
Understanding Rules of Conversion............................................................................................................................48
Variables..................................................................................................................................................................................49
Case Sensitivity............................................................................................................................................................50
i
Table of Contents
Constants.....................................................................................................................................................................51
Expressions..............................................................................................................................................................................51
Understanding Expressions.........................................................................................................................................51
Understanding Expression Operators..........................................................................................................................52
Understanding Operator Precedence...........................................................................................................................58
Extending sObject and List Expressions.....................................................................................................................59
Using Comments.........................................................................................................................................................59
Assignment Statements...........................................................................................................................................................59
Conditional (If-Else) Statements............................................................................................................................................61
Loops.......................................................................................................................................................................................61
Do-While Loops.........................................................................................................................................................62
While Loops................................................................................................................................................................62
For Loops....................................................................................................................................................................63
Traditional For Loops.....................................................................................................................................63
List or Set Iteration For Loops........................................................................................................................64
SOQL For Loops............................................................................................................................................64
SOQL and SOSL Queries......................................................................................................................................................66
Working with SOQL and SOSL Query Results.........................................................................................................67
Working with SOQL Aggregate Functions................................................................................................................68
Working with Very Large SOQL Queries..................................................................................................................69
Using SOQL Queries That Return One Record........................................................................................................71
Improving Performance by Not Searching on Null Values.........................................................................................71
Understanding Foreign Key and Parent-Child Relationship SOQL Queries.............................................................72
Using Apex Variables in SOQL and SOSL Queries...................................................................................................73
Querying All Records with a SOQL Statement..........................................................................................................74
Locking Statements.................................................................................................................................................................74
Locking in a SOQL For Loop....................................................................................................................................75
Avoiding Deadlocks....................................................................................................................................................75
Transaction Control................................................................................................................................................................75
Exception Statements..............................................................................................................................................................76
Throw Statements.......................................................................................................................................................76
Try-Catch-Finally Statements.....................................................................................................................................76
Chapter 3: Invoking Apex...................................................................................................................78
Triggers...................................................................................................................................................................................79
Bulk Triggers...............................................................................................................................................................80
Trigger Syntax.............................................................................................................................................................80
Trigger Context Variables...........................................................................................................................................81
Context Variable Considerations.................................................................................................................................83
Common Bulk Trigger Idioms....................................................................................................................................84
Using Maps and Sets in Bulk Triggers............................................................................................................84
Correlating Records with Query Results in Bulk Triggers..............................................................................84
Using Triggers to Insert or Update Records with Unique Fields.....................................................................85
Defining Triggers........................................................................................................................................................85
Triggers and Merge Statements..................................................................................................................................87
ii
Table of Contents
Triggers and Recovered Records.................................................................................................................................87
Triggers and Order of Execution.................................................................................................................................88
Operations That Don't Invoke Triggers......................................................................................................................89
Fields that Cannot Be Updated by Triggers................................................................................................................91
Trigger Exceptions......................................................................................................................................................91
Trigger and Bulk Request Best Practices.....................................................................................................................92
Apex Scheduler........................................................................................................................................................................93
Anonymous Blocks..................................................................................................................................................................98
Apex in AJAX.........................................................................................................................................................................99
Chapter 4: Classes, Objects, and Interfaces........................................................................................101
Understanding Classes..........................................................................................................................................................102
Defining Apex Classes...............................................................................................................................................102
Extended Class Example...........................................................................................................................................103
Declaring Class Variables..........................................................................................................................................106
Defining Class Methods............................................................................................................................................107
Using Constructors....................................................................................................................................................108
Access Modifiers........................................................................................................................................................109
Static and Instance.....................................................................................................................................................111
Using Static Methods and Variables..............................................................................................................111
Using Instance Methods and Variables..........................................................................................................112
Using Initialization Code...............................................................................................................................113
Apex Properties.........................................................................................................................................................114
Interfaces and Extending Classes..........................................................................................................................................116
Parameterized Typing and Interfaces........................................................................................................................117
Custom Iterators........................................................................................................................................................119
Keywords...............................................................................................................................................................................121
Using the final Keyword............................................................................................................................................122
Using the instanceof Keyword...................................................................................................................................122
Using the super Keyword...........................................................................................................................................122
Using the this Keyword.............................................................................................................................................123
Using the transient Keyword.....................................................................................................................................124
Using the with sharing or without sharing Keywords................................................................................................125
Annotations...........................................................................................................................................................................127
Deprecated Annotation.............................................................................................................................................127
Future Annotation.....................................................................................................................................................128
IsTest Annotation.....................................................................................................................................................129
ReadOnly Annotation...............................................................................................................................................131
RemoteAction Annotation........................................................................................................................................131
Apex REST Annotations..........................................................................................................................................132
RestResource Annotation..............................................................................................................................132
HttpDelete Annotation.................................................................................................................................133
HttpGet Annotation......................................................................................................................................133
HttpPatch Annotation...................................................................................................................................133
HttpPost Annotation.....................................................................................................................................133
iii
Table of Contents
剩余582页未读,继续阅读
梦想田园
- 粉丝: 17
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0