没有合适的资源?快使用搜索试试~ 我知道了~
首页salesforce_apex_language
salesforce_apex_language
3星 · 超过75%的资源 需积分: 12 26 下载量 195 浏览量
更新于2023-06-13
评论 1
收藏 4.9MB PDF 举报
salesforce的开发语言Apex语言的参考书,详细解释了Apex语言的开发。适合salesforce的开发员和需要靠DEV401认证的人员
资源详情
资源评论
资源推荐
salesforce: Summer '12
Force.com Apex Code Developer's Guide
Last updated: May 26 2012
©
Copyright 2000–2012 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?..........................................................................................................................................21
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................................................................................................................28
Creating a Custom Object...............................................................................................................................28
Adding an Apex Class.....................................................................................................................................29
Adding an Apex Trigger..................................................................................................................................30
Adding a Test Class.........................................................................................................................................31
Deploying Components to Production............................................................................................................33
Chapter 2: Language Constructs.........................................................................................................35
Data Types..............................................................................................................................................................................36
Primitive Data Types...................................................................................................................................................36
sObject Types..............................................................................................................................................................39
Accessing sObject Fields..................................................................................................................................40
Accessing sObject Fields Through Relationships............................................................................................41
Validating sObjects and Fields .......................................................................................................................42
Collections...................................................................................................................................................................43
Lists.................................................................................................................................................................43
Sets..................................................................................................................................................................45
Maps................................................................................................................................................................46
Maps from SObject Arrays..............................................................................................................................47
Iterating Collections........................................................................................................................................47
Enums.........................................................................................................................................................................47
Understanding Rules of Conversion............................................................................................................................49
Variables..................................................................................................................................................................................51
Case Sensitivity............................................................................................................................................................51
i
Table of Contents
Constants.....................................................................................................................................................................52
Expressions..............................................................................................................................................................................52
Understanding Expressions.........................................................................................................................................52
Understanding Expression Operators..........................................................................................................................53
Understanding Operator Precedence...........................................................................................................................59
Extending sObject and List Expressions.....................................................................................................................60
Using Comments.........................................................................................................................................................60
Assignment Statements...........................................................................................................................................................61
Conditional (If-Else) Statements............................................................................................................................................62
Loops.......................................................................................................................................................................................63
Do-While Loops.........................................................................................................................................................63
While Loops................................................................................................................................................................63
For Loops....................................................................................................................................................................64
Traditional For Loops.....................................................................................................................................65
List or Set Iteration For Loops........................................................................................................................65
SOQL For Loops............................................................................................................................................65
SOQL and SOSL Queries......................................................................................................................................................67
Working with SOQL and SOSL Query Results.........................................................................................................69
Working with SOQL Aggregate Functions................................................................................................................69
Working with Very Large SOQL Queries..................................................................................................................70
Using SOQL Queries That Return One Record........................................................................................................72
Improving Performance by Not Searching on Null Values.........................................................................................73
Understanding Foreign Key and Parent-Child Relationship SOQL Queries.............................................................73
Using Apex Variables in SOQL and SOSL Queries...................................................................................................74
Querying All Records with a SOQL Statement..........................................................................................................75
Locking Statements.................................................................................................................................................................75
Locking in a SOQL For Loop....................................................................................................................................76
Avoiding Deadlocks....................................................................................................................................................76
Transaction Control................................................................................................................................................................76
Exception Statements..............................................................................................................................................................77
Throw Statements.......................................................................................................................................................77
Try-Catch-Finally Statements.....................................................................................................................................77
Chapter 3: Invoking Apex...................................................................................................................79
Triggers...................................................................................................................................................................................80
Bulk Triggers...............................................................................................................................................................81
Trigger Syntax.............................................................................................................................................................81
Trigger Context Variables...........................................................................................................................................82
Context Variable Considerations.................................................................................................................................84
Common Bulk Trigger Idioms....................................................................................................................................85
Using Maps and Sets in Bulk Triggers............................................................................................................85
Correlating Records with Query Results in Bulk Triggers..............................................................................86
Using Triggers to Insert or Update Records with Unique Fields.....................................................................86
Defining Triggers........................................................................................................................................................86
Triggers and Merge Statements..................................................................................................................................88
ii
Table of Contents
Triggers and Recovered Records.................................................................................................................................89
Triggers and Order of Execution.................................................................................................................................89
Operations That Don't Invoke Triggers......................................................................................................................91
Fields that Aren’t Available or Can’t Be Updated in Triggers.....................................................................................92
Trigger Exceptions......................................................................................................................................................93
Trigger and Bulk Request Best Practices.....................................................................................................................93
Apex Scheduler........................................................................................................................................................................94
Anonymous Blocks..................................................................................................................................................................99
Apex in AJAX.......................................................................................................................................................................100
Chapter 4: Classes, Objects, and Interfaces........................................................................................102
Understanding Classes..........................................................................................................................................................103
Defining Apex Classes...............................................................................................................................................103
Extended Class Example...........................................................................................................................................104
Declaring Class Variables..........................................................................................................................................107
Defining Class Methods............................................................................................................................................108
Using Constructors....................................................................................................................................................110
Access Modifiers........................................................................................................................................................112
Static and Instance.....................................................................................................................................................113
Using Static Methods and Variables..............................................................................................................113
Using Instance Methods and Variables..........................................................................................................114
Using Initialization Code...............................................................................................................................115
Apex Properties.........................................................................................................................................................116
Interfaces and Extending Classes..........................................................................................................................................118
Parameterized Typing and Interfaces........................................................................................................................119
Custom Iterators........................................................................................................................................................122
Keywords...............................................................................................................................................................................124
Using the final Keyword............................................................................................................................................124
Using the instanceof Keyword...................................................................................................................................124
Using the super Keyword...........................................................................................................................................124
Using the this Keyword.............................................................................................................................................126
Using the transient Keyword.....................................................................................................................................126
Using the with sharing or without sharing Keywords................................................................................................127
Annotations...........................................................................................................................................................................129
Deprecated Annotation.............................................................................................................................................130
Future Annotation.....................................................................................................................................................130
IsTest Annotation.....................................................................................................................................................132
ReadOnly Annotation...............................................................................................................................................135
RemoteAction Annotation........................................................................................................................................135
Apex REST Annotations..........................................................................................................................................136
RestResource Annotation..............................................................................................................................136
HttpDelete Annotation.................................................................................................................................137
HttpGet Annotation......................................................................................................................................137
HttpPatch Annotation...................................................................................................................................137
HttpPost Annotation.....................................................................................................................................137
iii
Table of Contents
剩余634页未读,继续阅读
救护车
- 粉丝: 8
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- 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
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2