/// d ##class(PHA.OP.MOB.Test).KillOREF()
ClassMethod KillOREF()
{
s LocalInstance = ##class(PHA.OP.MOB.TestTwo).%New()
s LocalInstance1 = ##class(PHA.OP.MOB.TestTwo).%New()
s LocalInstance.date=+$h
s LocalInstance1.date=+$h
w "LocalInstance: "_LocalInstance.date,!
k LocalInstance
w "LocalInstance1: "_LocalInstance1.date,!
;s LocalInstance.date=+$h //K掉后 就写不出来了
}
OREFs、SET命令和系统功能
对于某些系统函数(例如 P i e c e 、 Piece、 Piece、Extract和$List),Caché支持一种可用于修改现有值的替代语法。该语法将函数与SET命令组合如下:
/// d ##class(PHA.OP.MOB.Test).KillOREF()
ClassMethod KillOREF1() [ Language = basic ]
{
SET function_expression = value
}
Class PHA.OP.MOB.TestTwo Extends PHA.OP.MOB.Test
{
Property date As %Date;
Property value As %Date;
Method %OnNew(initvalue As %String) As %Status [ Private, ServerOnly = 1 ]
{
s ..value=initvalue
s ..date=$zd(+$h,3)
w ..date,!
w ..value,!
Quit $$$OK
}
}
/// d ##class(PHA.OP.MOB.Test).TestOnNew()
ClassMethod TestOnNew()
{
s LocalInstance = ##class(PHA.OP.MOB.TestTwo).%New("测试")
s LocalInstance.date=+$h
s value=LocalInstance.value
w LocalInstance.date,!
w value,!
}
set person.HomeAddress.Street="15 Mulberry Street"
/// d ##class(PHA.OP.MOB.Test).TestCascad()
ClassMethod TestCascad()
{
s LocalInstance = ##class(PHA.OP.MOB.TestTwo).%New("测试")
s age=LocalInstance.address.age
}
Class PHA.OP.MOB.TestTwo Extends PHA.OP.MOB.Test
{
Property date As %Date;
Property value As %Date;
Property address As PHA.OP.MOB.TestThree;
}
Class PHA.OP.MOB.TestThree Extends %RegisteredObject
{
Property age;
}
在本例中,person变量是OREF,表达式是person。家庭住址也是一个OREF。
通常在引用类成员时,有时使用以下非正式引用:PackageName.ClassName.Member, 例如, the Accounting.Invoice.LineItem property。这种形式永远不会出现在代码中。
#Include %occStatus
set person=##class(Sample.Person).%New()
set person.DOB="December 12 1990"
set status=person.%ValidateObject()
write !, "First try"
if $$$ISERR(status) {
do $system.OBJ.DisplayError(status)
} else {
write !, "Object is valid"
}
set person.Name="Ellsworth,Myra Q."
set person.SSN="000-00-0000"
set person.DOB=$zdateh("December 12 1990",5)
set status=person.%ValidateObject()
write !!, "Second try"
if $$$ISERR(status) {
do $system.OBJ.DisplayError(status)
} else {
write !, "Object is valid"
}
运行这个例子,你会看到以下输出:
First try
ERROR #7207: Datatype value 'December 12 1990' is not a valid number
> ERROR #5802: Datatype validation failed on property 'Sample.Person:DOB', with value equal to "December 12 1990"
ERROR #5659: Property 'Sample.Person::Name([email protected],ID=)' required
ERROR #5659: Property 'Sample.Person::SSN([email protected],ID=)' required
ERROR #7209: Datatype value '' does not match PATTERN '3N1"-"2N1"-"4N'
> ERROR #5802: Datatype validation failed on property 'Sample.Person:SSN', with value equal to ""
Second try
Object is valid
/// d ##class(PHA.OP.MOB.Test).IsExtend()
ClassMethod IsExtend()
{
s LocalInstance = ##class(PHA.OP.MOB.TestTwo).%New("测试")
w LocalInstance.%Extends("%RegisteredObject"),!
w LocalInstance.%Extends("PHA.OP.MOB.Test"),!
w LocalInstance.%Extends("PHA.OP.MOB.Android"),!
}
/// d ##class(PHA.OP.MOB.Test).IsA()
ClassMethod IsA()
{
s LocalInstance = ##class(PHA.OP.MOB.TestTwo).%New("测试")
w LocalInstance.%IsA("%RegisteredObject"),!
w LocalInstance.%IsA("PHA.OP.MOB.Test"),!
w LocalInstance.%IsA("PHA.OP.MOB.Android"),!
}
/// d ##class(PHA.OP.MOB.Test).GetClassName()
ClassMethod GetClassName()
{
s mTwo = ##class(PHA.OP.MOB.TestTwo).%New("测试")
s mThree = ##class(PHA.OP.MOB.TestThree).%New("测试")
w mTwo.%ClassName(1),!
w mTwo.%ClassName(0),!
w mThree.%ClassName(1),!
w mThree.%ClassName(0),!
w mTwo.%PackageName(),!
w mThree.%PackageName(),!
}
/// d ##class(PHA.OP.MOB.Test).CloningObjects()
ClassMethod CloningObjects()
{
s mTwo = ##class(PHA.OP.MOB.TestTwo).%New("测试")
s mTwoClone=mTwo.%ConstructClone()
b
}
Method CalcTax() As %Numeric
{
Set TaxRate = ##class(Accounting.Utils).GetTaxRate($this)
Write "The tax rate for ",..City,", ",..State," is ",TaxRate*100,"%",!
Set TaxableSubtotal = ##class(Accounting.Utils).GetTaxableSubTotal($this)
Write "The taxable subtotal for this order is $",TaxableSubtotal,!
Set Tax = TaxableSubtotal * TaxRate
Write "The tax for this order is $",Tax,!
}
ClassMethod GetTaxRate(OrderBeingProcessed As Accounting.Order) As %Numeric
{
Set LocalCity = OrderBeingProcessed.City
Set LocalState = OrderBeingProcessed.State
// code to determine tax rate based on location and set
// the value of OrderBeingProcessed.TaxRate accordingly
Quit OrderBeingProcessed.TaxRate
}
>Do MyOrder.CalcTax()
The tax rate for Cambridge, MA is 5%
The taxable subtotal for this order is $79.82
The tax for this order is $3.99
注意 ClassMethod 无法使用属性Property 只有Method方法才可以
Class PHA.OP.MOB.TestThree Extends %RegisteredObject
{
Property age;
ClassMethod testonMethod(my As PHA.OP.MOB.Test)
{
q "this is testmethod"
}
}
Class PHA.OP.MOB.Test Extends %RegisteredObject
{
/// d ##class(PHA.OP.MOB.Test).TestThisKey()
ClassMethod TestThisKey()
{
s a=##class(PHA.OP.MOB.TestThree).testonMethod($this)
WRITE a
}
}
DHC-APP>d ##class(PHA.OP.MOB.Test).TestThisKey()
this is testmethod
Method %OnNew(initvalue As %String) As %Status [ Private, ServerOnly = 1 ]
{
s ..value=initvalue
s ..date=$zd(+$h,3)
w ..date,!
w ..value,!
w "i%value:"_i%value,!
w "i%date:"_i%date,!
w "i%address:"_i%address,!
Quit $$$OK
}
--只包含执行部分的PL/SQL块
--set serveroutput off
begin
dbms_output.put_line('Hello,everyone!');
end;
select * from emp;
--包含定义部分和执行部分的PL/SQL块
declare
v_ename varchar2(5);
begin
select
转:http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin
maven报错:
Plugin execution not covered by lifecycle configuration:
要使用MonkeyRunner,就要学习使用Python,哎
先抄一段官方doc里的代码
作用是启动一个程序(应该是启动程序默认的Activity),然后按MENU键,并截屏
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRun