JP2007213487A - Aspect generation method and apparatus - Google Patents

Aspect generation method and apparatus Download PDF

Info

Publication number
JP2007213487A
JP2007213487A JP2006035195A JP2006035195A JP2007213487A JP 2007213487 A JP2007213487 A JP 2007213487A JP 2006035195 A JP2006035195 A JP 2006035195A JP 2006035195 A JP2006035195 A JP 2006035195A JP 2007213487 A JP2007213487 A JP 2007213487A
Authority
JP
Japan
Prior art keywords
class
name
advice
signature
candidate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006035195A
Other languages
Japanese (ja)
Inventor
Yoshiyuki Kawamura
嘉之 河村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Software Engineering Co Ltd
Original Assignee
Hitachi Software Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Software Engineering Co Ltd filed Critical Hitachi Software Engineering Co Ltd
Priority to JP2006035195A priority Critical patent/JP2007213487A/en
Publication of JP2007213487A publication Critical patent/JP2007213487A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To facilitate generation of an aspect to be included in an assumed point in a program. <P>SOLUTION: An aspect generation apparatus is equipped with: a class information analysis means for analyzing a class structure, acquiring a name of the class, a name of a method, and a signature used in each class, and generating candidates for the name of the class, name of the method, and the signature to be defined in an aspect to be generated; an advise analysis means for analyzing a data structure of candidates for advice given by the aspect to be cut out as shared processing; a management means for displaying on a user interface screen a class figure which clearly shows the name of the class, the name of the method, and the signature in use in a program to be developed and the candidates for the advice analyzed by the advice analysis means; and an aspect generating means for allowing the user to select the displayed candidates for the advice and candidates for the name of the class, the name of the method, and the signature and generating the aspect. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、アスペクト指向プログラミングにおけるアスペクト生成方法及び装置に関するものである。   The present invention relates to an aspect generation method and apparatus in aspect-oriented programming.

現在、アプリケーション開発において新しい概念である、アスペクト指向プログラミングが注目されている。
アスペクト指向とは、プログラム内に組み込まれている各モジュール間で共通に使われる機能を切り出し、それを後から自動的にプログラムに織り込んでいくものである。アスペクトの例として、ログやトランザクション管理などがあげられる。また、アスペクト指向は、オブジェクト指向と相反する概念ではないため、この2つを組み合わせて利用することが可能である。
ここで、ログを例に用いてアスペクト指向プログラミングについて説明する。
ログを出力する際、従来においては、ログコンポーネントを呼び出すコードをプログラム中から呼び出すことによって、ログを出力してきた。このような場合、開発者自身が担当しているモジュールにログコンポーネントを呼び出すコードを記述することが一般的であるが、個々の開発者のスキルによってログ出力の精度が異なるため、システム全体で均質な情報量のログを出力することは難しかった。
アスペクト指向プログラミングを用いることにより、ログを出力する機能をアスペクトとして切り出し、これをシステム全体のプログラムに対して自動的に織り込むことができるため、システム全体を通して均質な情報量のログを出力するようにすることが可能となる。
このようにアスペクト指向プログラミングを用いることにより、モジュール間で横断的に使用する機能を切り出して、設定によって後から埋め込むことが可能となる。
Currently, aspect-oriented programming, which is a new concept in application development, is drawing attention.
Aspect orientation refers to extracting functions that are used in common among modules installed in a program and automatically incorporating them into the program later. Examples of aspects include logs and transaction management. In addition, since aspect orientation is not a concept that contradicts object orientation, these two can be used in combination.
Here, aspect-oriented programming will be described using a log as an example.
Conventionally, when a log is output, the log is output by calling a code for calling a log component from the program. In such cases, it is common to write code that calls the log component in the module that the developer is in charge of, but the accuracy of log output varies depending on the skill of each developer, so the entire system is homogeneous. It was difficult to output a log with a large amount of information.
By using aspect-oriented programming, the log output function can be cut out as an aspect and automatically incorporated into the program of the entire system, so that a log with a uniform amount of information can be output throughout the system. It becomes possible to do.
By using aspect-oriented programming in this way, it is possible to cut out functions to be used across modules and embed them later by setting.

アスペクトは、そのアスペクトが行う処理を記述したアドバイスと、そのアドバイスをどこに埋め込むかを指定するポイントカットから構成されている。
アドバイスには、埋め込む先の処理を実行する前に実行されるbeforeアドバイス、後に実行されるafterアドバイス、その処理の前後を包み込むように実行されるaroundアドバイスの3種類がある。
また、メソッドに対するアドバイスとフィールドアクセスに対するアドバイスがある。
ポイントカットでは、あるクラスのどのメソッドを呼び出したか、どのフィールドにアクセスしたか、あるクラスをインスタンス化したかなどをポイントとして切り出して指定することができる。
ポイントカットは、クラス名やメソッド名などを直接指定する以外にも、ワイルドカード(*)を用いることによって一度に複数のポイントを指定することもできる。
An aspect is composed of an advice that describes the processing to be performed by the aspect and a pointcut that specifies where the advice is embedded.
There are three types of advice: before advice executed before executing the process of the embedding destination, after advice executed after, and around advice executed so as to wrap around the process.
There are also advice for methods and field access.
In pointcut, it is possible to specify by specifying which method of a certain class is called, which field is accessed, whether a certain class is instantiated, etc. as a point.
Pointcuts can be used to specify multiple points at once by using a wildcard (*) in addition to specifying class names and method names directly.

アスペクト指向プログラミングを実現するために、アスペクトをどのように定義するかを規定し、アドバイスをプログラムに織り込むことが必要となる。このような機能を実現する環境をアスペクト指向環境と呼ぶ。現在、オブジェクト指向言語であるJava(登録商標)と組み合わせて使えるアスペクト指向環境がいくつか利用可能である。ここでは、そのひとつであるAspectJのアスペクト表記方法を用いるものとする。   In order to realize aspect-oriented programming, it is necessary to define how aspects are defined and to incorporate advice into the program. An environment that realizes such a function is called an aspect-oriented environment. Currently, several aspect-oriented environments that can be used in combination with Java (registered trademark), which is an object-oriented language, are available. Here, one aspect aspect method of AspectJ is used.

AspectJでは、アスペクトの定義を以下のような形式で表記する。
package sample;
public aspect Debug {
pointcut callHello(): execution(* sample.Hello.sayHello(..));

Object around() : callHello() {
Object t = thisJoinPoint.getTarget();
System.out.println("target is " + t.getClass().getName());
Object result = proceed();
System.out.println("returning " + result);
return result;
}
}
In AspectJ, aspect definitions are written in the following format.
package sample;
public aspect Debug {
pointcut callHello (): execution (* sample.Hello.sayHello (..));

Object around (): callHello () {
Object t = thisJoinPoint.getTarget ();
System.out.println ("target is" + t.getClass (). GetName ());
Object result = proceed ();
System.out.println ("returning" + result);
return result;
}
}

アスペクトの定義は、pointcut句によるポイントカットの指定とアドバイスの実装から構成される。
pointcut句では、メソッドに対しては、execution宣言により実行、call宣言により呼び出しのポイントを指定できる。それぞれの宣言の引数には、メソッドのシグネチャを指定する。
メソッドのシグネチャは、「<戻り値> <クラス名>.<メソッド名>(引数)」で構成される。ここには、*(ワイルドカード)を用いることもでき、say*のように指定することにより、sayHello、sayGoodbyのようにsayで始まる文字列にマッチさせることもできる。
メソッドの引数は、受け付ける引数の型を記述する以外にも「..」を指定することにより任意の引数を指定することもできる。
また、pointcut句では、フィールドに対しては、get宣言により読み込みアクセス、set宣言により書き込みアクセスのポイントを指定できる。それぞれの宣言の引数には、フィールド名を指定する。
フィールド名は、「<クラス名>.<フィールド名>」で構成される。ここにもメソッドと同様にワイルドカードを指定することができる。
Aspect definition consists of specifying pointcuts using pointcut clauses and implementing advice.
In the pointcut clause, for a method, execution can be executed by an execution declaration, and a call point can be specified by a call declaration. The method signature is specified in the argument of each declaration.
The signature of the method is composed of “<return value><classname>.<Methodname> (argument)”. Here, you can use * (wild card), and by specifying like say *, you can match strings that start with say like sayHello, sayGoodby.
In addition to describing the type of argument to be accepted, an arbitrary argument can also be specified by specifying ".." for the method argument.
In the pointcut clause, for the field, the read access point can be specified by the get declaration and the write access point can be specified by the set declaration. The field name is specified as an argument of each declaration.
The field name consists of “<class name>. <Field name>”. You can specify wildcards here as well as methods.

AspectJの開発環境として、AJDTというツールがある。これを用いることにより、あるアスペクトがどのJavaクラスに適用されるかといった情報を表示することができる。また、アスペクトがどのようにクラスに適用されたかをシステム全体を通して見ることができるビューアも用意されている。
なお、本発明に関連する公知技術文献としては下記の特許文献1がある。
As a development environment of AspectJ, there is a tool called AJDT. By using this, it is possible to display information such as which Java class an aspect applies to. There is also a viewer that lets you see how aspects are applied to classes throughout the system.
In addition, there exists the following patent document 1 as a well-known technical document relevant to this invention.

特開2005-258944号JP 2005-258944 A

アスペクトを織り込み対象のプログラムのどの箇所に生成(織り込む)るかは、特別な生成式を用いる。この文法は通常のJavaなど既存のプログラム言語の文法と大きく異なるため、一般的な開発者にとって、これを習得し使いこなすことは容易ではない。
また、この生成式には、ワイルドカードなどを用いてプログラム中の複数のポイントにアスペクトを生成することが可能であり、これを用いることによって効率良くアスペクトの生成を行うことができる。しかし、これを用いた場合、そのアスペクトが自分が想定している箇所に正しく生成されているかを確認することは難しい。
すなわち、アスペクトの生成は、その文法および影響範囲の両面から見て、あまり簡単ではないのが現状である。
A special generation formula is used to determine (weave) an aspect in a program to be woven. This grammar is very different from existing programming languages such as Java, so it is not easy for general developers to learn and use it.
In addition, it is possible to generate an aspect at a plurality of points in a program by using a wild card or the like in this generation formula, and using this can generate an aspect efficiently. However, when this is used, it is difficult to confirm whether the aspect is correctly generated at the place where it is supposed.
In other words, the aspect generation is not so easy from the viewpoint of both the grammar and the scope of influence.

本発明の目的は、アスペクト指向プログラミングを用いたアプリケーション開発において、織り込み対象のプログラム中の想定箇所に織り込むアスペクトを容易に生成することができるアスペクト生成方法及び装置を提供することである。   An object of the present invention is to provide an aspect generation method and apparatus capable of easily generating an aspect to be woven into an assumed place in a program to be woven in application development using aspect-oriented programming.

上記目的を達成するために、本発明のアスペクト生成装置は、開発対象のプログラム内で使用されているクラスファイルを第1の記憶手段から読み出し、クラスファイル内の各クラスの構造を解析し、各クラスで使用されているクラス名、メソッド名、シグネチャを取得し、その取得したクラス名、メソッド名、シグネチャに基づき、生成するアスペクトに定義するクラス名、メソッド名、シグネチャの候補を生成するクラス情報解析手段と、共通処理として切り出すアスペクトが行うアドバイスの候補を第2の記憶手段から読み出し、アドバイスの候補のデータ構造を解析するアドバイス解析手段と、前記クラス情報解析手段によるクラス構造の解析結果に基づき開発対象のプログラム内で使用されているクラスについてクラス名、メソッド名、シグネチャを明示したクラス図と、前記アドバイス解析手段が解析したアドバイスの候補とをグラフィカルユーザインターフェース画面に表示させるユーザインターフェース管理手段と、前記グラフィカルユーザインターフェース画面に表示されたアドバイスの候補のうちユーザによって選択された任意のアイコンが前記クラス図中の任意のクラスの位置にドラッグされた場合に、当該クラスにおいて選択可能な、前記クラス情報解析手段によって生成されたクラス名、メソッド名、シグネチャの候補を表示し、ユーザによって選択されたクラス名、メソッド名、シグネチャの候補のデータを、ユーザによって選択されたアドバイスの候補のデータ構造に適用してアスペクトを生成するアスペクト生成手段とを備えることを特徴とする。
また、前記アスペクト生成手段は、生成したアスペクトに定義されたクラス名、メソッド名、シグネチャに一致するクラス名、メソッド名、シグネチャを持つクラス図中のクラスのメソッドを強調表示することを特徴とする。
In order to achieve the above object, the aspect generation apparatus of the present invention reads out a class file used in a program to be developed from the first storage means, analyzes the structure of each class in the class file, Class information used to acquire class names, method names, and signatures used in the class, and to generate class names, method names, and signature candidates defined in the generated aspect based on the acquired class names, method names, and signatures Based on the analysis result of the class structure by the analysis unit, the advice analysis unit that reads out the advice candidate performed by the aspect extracted as a common process from the second storage unit, and analyzes the data structure of the advice candidate Class names and methods for classes used in the program under development A user interface management means for displaying on the graphical user interface screen a class diagram in which a name and signature are clearly specified, and an advice candidate analyzed by the advice analysis means, and a user among the advice candidates displayed on the graphical user interface screen Class name, method name, signature candidate generated by the class information analysis means that can be selected in the class when the arbitrary icon selected by is dragged to the position of the arbitrary class in the class diagram And an aspect generation means for generating an aspect by applying the class name, method name, and signature candidate data selected by the user to the advice candidate data structure selected by the user. To
Further, the aspect generation means highlights a class name defined in the generated aspect, a method name, a class name matching the signature, a method name, and a method of a class in the class diagram having the signature. .

本発明に係るアスペクト生成方法は、第1の手段により、開発対象のプログラム内で使用されているクラスファイルを第1の記憶手段から読み出し、クラスファイル内の各クラスの構造を解析し、各クラスで使用されているクラス名、メソッド名、シグネチャを取得し、その取得したクラス名、メソッド名、シグネチャに基づき、生成するアスペクトに定義するクラス名、メソッド名、シグネチャの候補を生成する第1のステップと、第2の手段により、共通処理として切り出すアスペクトが行うアドバイスの候補を第2の記憶手段から読み出し、アドバイスの候補のデータ構造を解析する第2のステップと、第3の手段により、前記第1の手段によるクラス構造の解析結果に基づき開発対象のプログラム内で使用されているクラスについてクラス名、メソッド名、シグネチャを明示したクラス図と、前記第2の手段が解析したアドバイスの候補とをグラフィカルユーザインターフェース画面に表示させる第3のステップと、第4の手段により、前記グラフィカルユーザインターフェース画面に表示されたアドバイスの候補のうちユーザによって選択された任意のアイコンが前記クラス図中の任意のクラスの位置にドラッグされた場合に、当該クラスにおいて選択可能な、前記第1の手段によって生成されたクラス名、メソッド名、シグネチャの候補を表示し、ユーザによって選択されたクラス名、メソッド名、シグネチャの候補のデータを、ユーザによって選択されたアドバイスの候補のデータ構造に適用してアスペクトを生成する第4のステップとを備えることを特徴とする。
また、前記第4のステップにおいて、生成したアスペクトに定義されたクラス名、メソッド名、シグネチャに一致するクラス名、メソッド名、シグネチャを持つクラス図中のクラスのメソッドを強調表示することを特徴とする。
In the aspect generation method according to the present invention, the first means reads the class file used in the program to be developed from the first storage means, analyzes the structure of each class in the class file, The class name, method name, and signature used in the above are acquired, and based on the acquired class name, method name, and signature, the class name, method name, and signature candidate defined in the generated aspect are generated. And a second step of reading out advice candidates performed by the aspect extracted as a common process by the second means from the second storage means, and analyzing a data structure of the advice candidates, and the third means, About the class used in the development target program based on the analysis result of the class structure by the first means A third step of displaying on the graphical user interface screen a class diagram clearly indicating a class name, a method name, and a signature, and an advice candidate analyzed by the second means; Generated by the first means that can be selected in the class when an arbitrary icon selected by the user among the advice candidates displayed on the screen is dragged to the position of the arbitrary class in the class diagram The selected class name, method name, and signature candidate, and apply the class name, method name, and signature candidate data selected by the user to the advice candidate data structure selected by the user. And a fourth step of generating.
In the fourth step, the class name defined in the generated aspect, the method name, the class name matching the signature, the method name, and the method of the class in the class diagram having the signature are highlighted. To do.

本発明のアスペクト生成装置及び方法によれば、次のような効果がある。
(1)グラフィカルユーザインターフェース画面に表示されたクラス名、メソッド名、メソッドの引数のそれぞれの候補に対し、アスペクトとして切り出す処理(アドバイス)のアイコンをドラッグする操作により、開発者自身が想定しているアスペクトを容易に生成することができる。
(2)アスペクトを生成した場合に、その生成したアスペクトが、どのクラスのいずれのメソッドに織り込まれるかをクラス図中にグラフィカルに明示することにより、どのクラスのどのメソッドおよびフィールドが、生成したアスペクトの影響を受けるかを把握することができ、影響を受ける織り込み対象範囲を確認しながら、開発者自身が想定しているアスペクトを生成することができる。
The aspect generation apparatus and method of the present invention have the following effects.
(1) Assumed by the developer himself by dragging the icon of the processing (advice) to be cut out as an aspect to each candidate for the class name, method name, and method argument displayed on the graphical user interface screen Aspects can be easily generated.
(2) When an aspect is generated, it is graphically clearly shown in the class diagram that the generated aspect is woven into which method of which class, and which method and field of which class generates the generated aspect. The aspect assumed by the developer himself can be generated while confirming the affected range to be affected.

以下、本発明の一実施の形態を図面を参照して詳細に説明する。
図1は、本発明のアスペクト織り込み装置を実現するコンピュータのハードウェア構成例を示したブロック図である。
図1に示すコンピュータ(101)は、中央演算装置(CPU)(102)とメモリ(103)を備え、マザーボード(104)により接続されている。また、マザーボードに接続された磁気ディスク装置(HDD)(105)とグラフィックカード(106)を持ち、グラフィックカード(106)は外部のディスプレイ装置(107)と接続されている。
入力装置として、マウス(108)とキーボード(109)を備え、これらはマザーボード(104)に接続されている。
Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings.
FIG. 1 is a block diagram showing a hardware configuration example of a computer that realizes an aspect weaving apparatus according to the present invention.
A computer (101) shown in FIG. 1 includes a central processing unit (CPU) (102) and a memory (103), and is connected by a mother board (104). Further, it has a magnetic disk device (HDD) (105) and a graphic card (106) connected to the motherboard, and the graphic card (106) is connected to an external display device (107).
As an input device, a mouse (108) and a keyboard (109) are provided, and these are connected to the motherboard (104).

図2は、図1のハードウェア構成においてアスペクト織り込みを実現する構成を機能的に示した機能構成図であり、本発明のアスペクト織り込み装置(201)は、クラス情報解析部(202)、クラス蓄積部(203)、アドバイス解析部(204)、アドバイス蓄積部(205)、アスペクト生成部(206)、アスペクト蓄積部(207)、ユーザインターフェース管理部(208)で構成される。
クラス情報解析部(202)、アドバイス解析部(204)、、アスペクト生成部(206)、ユーザインターフェース管理部(208)は、具体的には、メモリ(103)内に格納されたプログラムによって構成されるものである。
ユーザインターフェース管理部(208)は、ディスプレイ装置(107)と入力装置(210)を構成するマウス(108)とキーボード(109)に接続されている。
FIG. 2 is a functional configuration diagram functionally showing a configuration for realizing aspect weaving in the hardware configuration of FIG. 1. The aspect weaving device (201) of the present invention includes a class information analysis unit (202), class storage Unit (203), advice analysis unit (204), advice storage unit (205), aspect generation unit (206), aspect storage unit (207), and user interface management unit (208).
The class information analysis unit (202), the advice analysis unit (204), the aspect generation unit (206), and the user interface management unit (208) are specifically configured by programs stored in the memory (103). Is.
The user interface management unit (208) is connected to a mouse (108) and a keyboard (109) that constitute the display device (107) and the input device (210).

クラス情報解析部(202)は、クラス蓄積部(203)およびユーザインターフェース管理部(208)と接続され、アドバイス解析部(204)はアドバイス蓄積部(205)とユーザインターフェース管理部(208)と接続されている。アスペクト生成部(206)は、アスペクト蓄積部(207)とユーザインターフェース管理部(208)と接続されている。
クラス蓄積部(203)、アドバイス蓄積部(205)、アスペクト蓄積部(206)は、磁気ディスク装置(105)上で実現される。
The class information analysis unit (202) is connected to the class storage unit (203) and the user interface management unit (208), and the advice analysis unit (204) is connected to the advice storage unit (205) and the user interface management unit (208). Has been. The aspect generation unit (206) is connected to the aspect storage unit (207) and the user interface management unit (208).
The class storage unit (203), advice storage unit (205), and aspect storage unit (206) are implemented on the magnetic disk device (105).

開発対象のプログラム内で使用されているモジュールあるいはクラスに共通する処理(あるいは機能)をアスペクトとして切り出し、アスペクト句内に定義するためには、アスペクトとして切り出すモジュールあるいはクラスの処理を把握する必要がある。本発明では、アスペクトの生成に当たって、まず、開発対象のプログラム内で使用されているモジュールあるいはクラスの構造を解析し、そこで使用されているメソッドのシグネチャを取得する。具体的には、クラス蓄積部(203)に蓄積されているプログラムのクラス図を取得し、そのクラス図中で使用されている各クラスの構造をクラス情報解析部(202)で解析し、各クラスで定義されているメソッドのシグネチャを取得する。
図3は、本発明で扱うクラスのメソッド情報のデータフォーマットの例を示す図であり、1つのメソッド情報は、ID(301)、クラス名(302)、メソッド名(303)、引数(304)、戻り値(305)で構成されている。クラスにあるメソッドひとつに対してひとつのエントリが対応する。同じ名前のメソッドでも引数の型が異なれば別のエントリとなる。
In order to extract processing (or function) common to modules or classes used in the development target program as an aspect and define it in an aspect phrase, it is necessary to grasp the processing of the module or class extracted as an aspect. . In the present invention, when generating an aspect, first, a structure of a module or class used in a program to be developed is analyzed, and a signature of a method used there is obtained. Specifically, the class diagram of the program stored in the class storage unit (203) is acquired, and the structure of each class used in the class diagram is analyzed by the class information analysis unit (202). Get the signature of the method defined in the class.
FIG. 3 is a diagram showing an example of the data format of method information of a class handled in the present invention. One method information includes ID (301), class name (302), method name (303), and argument (304). , And a return value (305). One entry corresponds to one method in the class. A method with the same name will have a different entry if its argument type is different.

図4は、クラスのフィールド情報のデータフォーマットの例を示す図であり、1つのフィールド情報は、ID(401)、クラス名(402)、フィールド名(403)で構成されている。

前述のように、アスペクトには、そのアスペクトが行う処理を記述したアドバイスを定義する必要がある。本発明では、定義するアドバイスの候補がアドバイス蓄積部(205)に予め蓄積されており、ここに蓄積されているアドバイスの候補のデータ構造をアドバイス解析部(204)で解析し、アドバイスの候補としてグラフィカルユーザインターフェース画面にメニュー形式で表示し、その中から、切り出すアスペクトに定義するアドバイスを選択させる。
図5は、アドバイス蓄積部(205)に蓄積されているアドバイス情報のデータフォーマットの例を示す図であり、1つのアドバイス情報は、ID(501)、名前(502)、ターゲット(503)、タイプ(504)、実装(505)で構成されている。名前(502)はそのアドバイスを認識できる任意の文字列となる。ターゲット(503)はメソッドもしくはフィールドである。タイプ(504)はaround、before、afterのいずれかである。実装(505)は、そのアドバイスのプログラムコードとなる。
FIG. 4 is a diagram showing an example of the data format of class field information. One field information is composed of an ID (401), a class name (402), and a field name (403).

As described above, it is necessary to define an advice that describes the processing to be performed by an aspect. In the present invention, advice candidates to be defined are stored in advance in the advice storage unit (205). The advice analysis unit (204) analyzes the data structure of the advice candidates stored in the advice storage unit (205). The menu is displayed on the graphical user interface screen, and the advice defined for the aspect to be cut out is selected from the menu format.
FIG. 5 is a diagram illustrating an example of a data format of advice information stored in the advice storage unit (205). One piece of advice information includes ID (501), name (502), target (503), and type. (504) and mounting (505). The name (502) is an arbitrary character string that can recognize the advice. The target (503) is a method or a field. The type (504) is one of around, before, and after. The implementation (505) becomes the program code of the advice.

図6は、アスペクト蓄積部(207)に蓄積されるアスペクトのプログラムコードであり、1つのアスペクトのプログラムコードは、アスペクト定義(601)、ポイントカット定義(602)、アドバイス定義(603)で構成されている。
アスペクト定義(601)には、そのaspect句によるアスペクト宣言とそのアスペクトの名前が記述される。
ポイントカット定義(602)には、pointcut句とポイントカット名、AspectJの文法によるポイントカット指定が記述される。
アドバイス定義(603)には、アドバイスの戻り値、アドバイスのタイプ、対応するポイントカット名、実装コードが記述される。
FIG. 6 shows the aspect program code stored in the aspect storage unit (207). One aspect program code is composed of an aspect definition (601), a point cut definition (602), and an advice definition (603). ing.
The aspect definition (601) describes the aspect declaration by the aspect phrase and the name of the aspect.
The pointcut definition (602) describes a pointcut phrase, a pointcut name, and a pointcut designation according to the AspectJ grammar.
The advice definition (603) describes a return value of advice, an advice type, a corresponding pointcut name, and an implementation code.

図7は、本実施形態のアスペクト生成装置のグラフィカルユーザインターフェース画面の一例を示す図であり、大別して、クラス図(701)とアドバイスツールボックス(707)の表示領域で構成される。
クラス図(701)は、クラス蓄積部(203)に格納されたプログラムを構成するクラスの構造(702)とそれぞれの関連を表す図であり、各クラスのクラス名(703)、フィールド(704)、メソッド(705)を図中に表現する。また、クラスの継承関係がある場合は、そのクラス同士を矢印(706)で結びつけて表示する。
クラス図(701)は、ユーザインターフェース画面を表示する際に、Java言語で記述されたクラスファイルをクラス蓄積部(203)から読み込み、クラス情報解析部(202)にて解析し、図3のメソッド情報および図4のフィールド情報に変換し、その情報をユーザインターフェース管理部(208)に送ることにより表示される。
FIG. 7 is a diagram showing an example of a graphical user interface screen of the aspect generation apparatus according to the present embodiment, which is roughly composed of a display area of a class diagram (701) and an advice tool box (707).
The class diagram (701) is a diagram showing the relationship between the structure (702) of the classes constituting the program stored in the class storage unit (203) and the respective relationships. The class name (703) and the field (704) of each class. , Method (705) is represented in the figure. If there is a class inheritance relationship, the classes are displayed by being linked by an arrow (706).
The class diagram (701) reads the class file described in the Java language from the class storage unit (203) when the user interface screen is displayed, and analyzes it by the class information analysis unit (202). It is displayed by converting the information and the field information of FIG. 4 and sending the information to the user interface management unit (208).

アドバイスツールボックス(707)は、アドバイス蓄積部(205)に蓄積されているアドバイスの一覧を表示する領域であり、メソッドに対するアドバイスを表示する領域(708)とフィールドに対するアドバイスを表示する領域(709)で構成される。
アドバイスツールボックス(707)は、グラフィカルユーザインターフェース画面を表示する際に、図5のアドバイス情報の形式でアドバイス蓄積部(205)に蓄積されているアドバイスを読み込み、アドバイス解析部(204)にて解析し、その情報をユーザインターフェース管理部(208)に送ることにより表示される。
The advice toolbox (707) is an area for displaying a list of advices accumulated in the advice accumulation unit (205), an area for displaying advice for a method (708), and an area for displaying advice for a field (709). Consists of.
When displaying the graphical user interface screen, the advice tool box (707) reads the advice stored in the advice storage unit (205) in the form of the advice information shown in FIG. 5, and analyzes it with the advice analysis unit (204). The information is displayed by sending it to the user interface management unit (208).

図8は、クラス図のクラスのメソッド上(801)に“Debug”というアドバイス(802)のアイコンをドラッグした際に表示されるメニュー(803)の例を示す図である。ここには、生成可能なクラス名のパターンが選択可能候補として表示される。
選択可能なクラス名のパターンには、例えば、「*」、「Login*」、「*Dao」、「LoginDao」がある。これらの選択可能なクラス名のパターンは、後述の図14で説明する処理により、クラス図中に使用されているクラス名を幾つかに分割して生成したものである。クラス図中に使用されているクラス名が「LoginDao」であった場合に、これを「Login」、「Dao」という文字列に分割し、これら文字列の前方、後方に「*」を付加したクラス名候補文字列を生成することにより、例えばクラス名の前方に「Login」という文字列が存在するクラス名のクラスの処理を共通のアスペクトとして定義することが可能になる。
FIG. 8 is a diagram showing an example of a menu (803) displayed when the advice (802) icon “Debug” is dragged on the method (801) of the class in the class diagram. Here, a class name pattern that can be generated is displayed as a selectable candidate.
Examples of selectable class name patterns include “*”, “Login *”, “* Dao”, and “LoginDao”. These selectable class name patterns are generated by dividing the class name used in the class diagram into several by the process described later with reference to FIG. When the class name used in the class diagram is "LoginDao", it is divided into the strings "Login" and "Dao", and "*" is added to the front and rear of these strings. By generating a class name candidate character string, it is possible to define, as a common aspect, class processing of a class name in which a character string “Login” exists in front of the class name, for example.

図9は、図8で表示されるメニュー(803)のクラス名のパターン(803)のうちの1つの上にアドバイス(802)をドラッグした際に表示されるメニュー(904)の例を示す図である。ここには設定できるメソッド名のパターンが選択可能候補として表示される。
この選択可能なメソッド名のパターンも、前記のクラス名のパターンと同様に生成されたものである。
FIG. 9 is a diagram showing an example of the menu (904) displayed when the advice (802) is dragged onto one of the class name patterns (803) of the menu (803) displayed in FIG. It is. The method name patterns that can be set are displayed as selectable candidates.
The selectable method name pattern is also generated in the same manner as the class name pattern.

図10は、図9で表示されるメニューのメソッド名のパターン(1004)のうちの1つの上にアドバイス(802)をドラッグした際に表示されるメニュー(1005)の例を示す図である。ここには設定できるメソッドの引数のパターンの候補が表示される。この選択可能なメソッドの引数のパターンも、前記のクラス名のパターンと同様に生成されたものである。   FIG. 10 is a diagram showing an example of the menu (1005) displayed when the advice (802) is dragged onto one of the method name patterns (1004) of the menu displayed in FIG. Here, method argument patterns that can be set are displayed. This selectable method argument pattern is also generated in the same manner as the class name pattern.

図11は、図10で表示されるメニュー(1005)のメソッドの引数のパターンのうちの1つの上にアドバイス(802)をドラッグした際のグラフィカルユーザインターフェース画面の全体を示した図である。このときに、クラス名、メソッド名、メソッド引数のパターンが決定するため、これを組み合わせてポイントカットに指定するメソッドシグネチャのパターンが決定できる。
メソッドの戻り値のパターンは、クラス名、メソッド名、メソッド引数にワイルドカードが含まれる場合は「*」、含まれない場合は、特定されたメソッドの戻り値となる。
このグラフィカルユーザインターフェース画面に表示されているクラス図内において、選択されたポイントカットに指定するメソッドシグネチャのパターンに適合するメソッドがハイライト(図11の網掛け表示部分)されて表示される。
FIG. 11 is a diagram showing the entire graphical user interface screen when the advice (802) is dragged onto one of the method argument patterns of the menu (1005) displayed in FIG. At this time, since the pattern of the class name, method name, and method argument is determined, the pattern of the method signature specified for the pointcut can be determined by combining these.
The method return value pattern is “*” when a wildcard is included in the class name, method name, and method argument, and is the return value of the specified method otherwise.
In the class diagram displayed on the graphical user interface screen, a method that matches the method signature pattern designated for the selected pointcut is highlighted (the shaded display portion in FIG. 11) and displayed.

図12は、メソッドのシグネチャが選択された後にグラフィカルユーザインターフェース画面に表示されるメソッドのポイントカットの種別を選択するダイアログの例を示す図であり、選択可能なポイントカットの種別が表示されて、その中の1つをラジオボタンを用いて選択する。メソッドに対するポイントカット種別は、そのメソッドの実行(execution)とそのメソッドの呼び出し(call)の2種類がある。   FIG. 12 is a diagram showing an example of a dialog for selecting a method pointcut type displayed on the graphical user interface screen after the method signature is selected, and the selectable pointcut types are displayed. One of them is selected using a radio button. There are two types of pointcuts for a method: execution of the method (execution) and call of the method (call).

以下、以上のように構成されたアスペクト生成装置の動作を図13〜図15に示すフローチャートを参照して説明する。
図13は、アスペクト生成過程におけるユーザの動作を示すフローチャートである。
ここでは、メソッドに対してアスペクトを生成する際の動作を説明する。
まず、ユーザは、図7のアドバイスツールボックス(707)のアドバイス表示領域(708)からアドバイスの1つのアイコン(802)を選択し、それをクラス図のメソッド上にドラッグする(ステップ1301)。
すると、図8に示したように、生成可能なクラス名のパターンがメニュー(803)上に表示されるので、その1つの上にアドバイス(802)のアイコンをドラッグする(ステップ1302)。
すると、図9に示したように、生成可能なメソッド名のパターンがメニュー(904)上に表示されるので、その1つの上にアドバイス(802)のアイコンをドラッグする(ステップ1303)。
すると、図10に示したように、生成可能なメソッド引数のパターンがメニュー(1005)上に表示されるので、その1つの上にアドバイス(802)のアイコンをドラッグする(ステップ1304)。
Hereinafter, the operation of the aspect generation apparatus configured as described above will be described with reference to the flowcharts shown in FIGS.
FIG. 13 is a flowchart showing a user operation in the aspect generation process.
Here, the operation when an aspect is generated for a method will be described.
First, the user selects one advice icon (802) from the advice display area (708) of the advice tool box (707) of FIG. 7, and drags it onto the method of the class diagram (step 1301).
Then, as shown in FIG. 8, a pattern of class names that can be generated is displayed on the menu (803), and the advice (802) icon is dragged onto one of the patterns (step 1302).
Then, as shown in FIG. 9, since a pattern of method names that can be generated is displayed on the menu (904), the advice (802) icon is dragged onto one of them (step 1303).
Then, as shown in FIG. 10, since a pattern of method arguments that can be generated is displayed on the menu (1005), the advice (802) icon is dragged onto one of the patterns (step 1304).

この状態でアドバイス(802)を適用するメソッドのシグネチャのパターンが特定されるので、グラフィックユーザインタフェース画面に表示されているクラス図中で、前記選択操作によって生成したアスペクトが適応されるメソッドが図11の網掛け部分で示すようにハイライト表示される。
ここで、メニュー上にアドバイス(802)のアイコンをドロップすると(ステップ1305)、図12のダイアログが表示される。
そこで、ポイントカットの種別を選択し(ステップ1306)、OKボタン(1201)を押下すると、その条件にあった図6に示したアスペクトのプログラムコードが生成されて、アスペクト蓄積部(207)の中に格納される。
このとき、アスペクト定義(601)に用いられるアスペクトの名前は、選択した「アドバイスの名前+Aspect+通し番号」とする。また、ポイントカット定義(602)に用いられるポイントカットの名前は、「選択したアドバイスの名前(大文字は小文字に変換)+通し番号」とする。さらに、アドバイス定義(603)の実装コードには、選択したアドバイスの実装フィールドの値を入れる。
Since the signature pattern of the method to which the advice (802) is applied is specified in this state, the method to which the aspect generated by the selection operation is applied in the class diagram displayed on the graphic user interface screen is shown in FIG. Is highlighted as shown by the shaded area.
If the advice (802) icon is dropped on the menu (step 1305), the dialog shown in FIG. 12 is displayed.
Therefore, when the type of point cut is selected (step 1306) and the OK button (1201) is pressed, the program code of the aspect shown in FIG. 6 corresponding to the condition is generated and stored in the aspect storage unit (207). Stored in
At this time, the name of the aspect used in the aspect definition (601) is the selected “advice name + Aspect + serial number”. The name of the pointcut used in the pointcut definition (602) is “the name of the selected advice (upper case is converted to lower case) + serial number”. Further, the value of the implementation field of the selected advice is entered in the implementation code of the advice definition (603).

次に、ステップ1302において、クラス名のパターンの候補を表示する際の処理を図14のフローチャートを参照して説明する。
この処理は、クラス名の一部と「*」を組み合わせることによってパターンの候補となる文字列を生成する処理である。
この処理は、クラス情報解析部(202)が実行する処理である。
はじめに、生成するパターンを格納するための候補配列を初期化する(ステップ1401)。
候補配列は単純な文字列の配列になる。この候補配列に、パターンの1つとしてクラス名を追加する(ステップ1402)。
ここで、追加するクラス名のパターンはクラス蓄積部(203)に格納されたメソッド情報(図3)から取得するものである。
Next, in step 1302, processing for displaying class name pattern candidates will be described with reference to the flowchart of FIG.
This process is a process for generating a character string as a pattern candidate by combining a part of the class name and “*”.
This process is a process executed by the class information analysis unit (202).
First, a candidate sequence for storing a pattern to be generated is initialized (step 1401).
The candidate sequence is a simple sequence of character strings. A class name is added to this candidate sequence as one of the patterns (step 1402).
Here, the pattern of the class name to be added is obtained from the method information (FIG. 3) stored in the class storage unit (203).

次に、クラス名の文字列を分割する。ここでは、例として大文字を区切りに分割する。例えば、UserDaoImplクラスであれば、“User”、“Dao”、“Impl”の3つの部分に区切る。これを文節配列に格納する(ステップ1403)。文節配列は単純な文字列配列である。ここでは、大文字を区切りに文字列を分割したが、これ以外にも、1文字ごとに区切る方法や辞書を使って区切る方法などほかの方法を使うことも可能である。
次に、文節配列の要素と「*」を組み合わせてパターン文字列を生成する。
最初に配列のインデックスとなる整数値nを1に初期化する(ステップ1404)。そして、文節配列の先頭からn個の文字列を連結し(ステップ1405)、その末尾に「*」を付加して(ステップ1406)、パターン文字列を生成しそれを候補配列に追加する(ステップ1407)。
次に、インデックスnをインクリメントして(ステップ1408)、nが配列の長さよりも小さければ(ステップ1409)、1ステップ405からの処理を繰り返す。
これを、n−1回繰り返すことにより、後方にワイルドカードがあるパターンが生成される。例えば、前述の例では、User*、UserDao*というパターンが生成される。
次に、インデックスnを再度“1”で初期化する(ステップ1410)。そして、文節配列のn+1から末尾までの要素の文字列を連結し(ステップ1411)、その先頭に「*」を付加して(ステップ1412)、パターン文字列を生成しそれを候補配列に追加する(ステップ1413)。
次に、インデックスnをインクリメントして(ステップ1414)、nが配列の長さよりも小さければ(ステップ1415)、ステップ1411からの処理を繰り返す。
これを、n−1回繰り返すことにより、前方にワイルドカードがあるパターンが生成される。例えば、前述の例では、*DaoImpl、*Implというパターンが生成される。
最後に、候補配列に「*」を追加する。このとき、候補配列に格納されているパターンが、クラスのパターンの選択候補になる。メソッド名やフィールド名に対するパターンも同様に生成することができる。
Next, the character string of the class name is divided. Here, as an example, uppercase characters are divided into divisions. For example, in the case of the UserDaoImpl class, it is divided into three parts “User”, “Dao”, and “Impl”. This is stored in the phrase array (step 1403). The phrase array is a simple string array. Here, the character string is divided with capital letters as a separator, but other methods such as a method for separating characters one by one or a method using a dictionary can also be used.
Next, a pattern character string is generated by combining the elements of the phrase array and “*”.
First, an integer value n which is an index of the array is initialized to 1 (step 1404). Then, n character strings are concatenated from the beginning of the phrase array (step 1405), and "*" is added to the end (step 1406) to generate a pattern character string and add it to the candidate array (step 1406). 1407).
Next, the index n is incremented (step 1408), and if n is smaller than the length of the array (step 1409), the processing from step 1405 is repeated.
By repeating this n-1 times, a pattern having a wild card behind is generated. For example, in the above example, the patterns User * and UserDao * are generated.
Next, the index n is initialized again with “1” (step 1410). Then, the character strings of the elements from n + 1 to the end of the phrase array are concatenated (step 1411), “*” is added to the head (step 1412), and a pattern character string is generated and added to the candidate array. (Step 1413).
Next, the index n is incremented (step 1414), and if n is smaller than the length of the array (step 1415), the processing from step 1411 is repeated.
By repeating this n-1 times, a pattern with a wild card in front is generated. For example, in the above example, the patterns * DaoImpl and * Impl are generated.
Finally, “*” is added to the candidate sequence. At this time, the pattern stored in the candidate sequence becomes a class pattern selection candidate. Patterns for method names and field names can be generated in the same way.

次に、ステップ1304において、クラス名、メソッド名、引数のパターンを確定した際にパターンがマッチするメソッドをハイライト表示する際に、生成したパターンにマッチするメソッドを抽出する処理を図15のフローチャートを参照して説明する。この処理は、クラス情報解析部(202)が実行する処理である。
最初に、クラス蓄積部(203)に格納されているJavaクラスファイルを読み込み、クラス情報解析部(202)において、各クラスのメソッドを、図3のメソッド情報フォーマットの形式で候補配列に格納する(ステップ1501)。
次に、結果を格納する結果配列を空の状態に初期化する(ステップ1502)。この配列も図3のメソッド情報フォーマットに従った配列である。
Next, in step 1304, when highlighting the method that matches the pattern when the class name, method name, and argument pattern are confirmed, the process of extracting the method that matches the generated pattern is shown in the flowchart of FIG. Will be described with reference to FIG. This process is a process executed by the class information analysis unit (202).
First, the Java class file stored in the class storage unit (203) is read, and the method of each class is stored in the candidate array in the method information format of FIG. 3 in the class information analysis unit (202) ( Step 1501).
Next, the result array for storing the results is initialized to an empty state (step 1502). This array is also an array according to the method information format of FIG.

次に、配列のインデックスnを“1”で初期化する(ステップ1503)。
次に、候補配列のn番目の要素を取り出し、そのクラス名フィールドがユーザによって選択されたクラス名のパターンに適合するか判定する(ステップ1504)。適合した場合は、メソッド名フィールドの判定に移る。適合しない場合は、その要素に対する処理を中断する
次に、メソッド名フィールドがユーザによって選択されたメソッド名のパターンに適合するか判定する(ステップ1505)。適合した場合は、メソッド引数の判定に移る。適合しない場合は、その要素に対する処理を中断する。
次に、メソッド引数フィールドがユーザによって選択されたメソッド引数のパターンに適合するか判定する(ステップ1506)。適合した場合は、その要素を結果配列に追加する。適合しない場合は、その要素に対する処理を中断する。
次に、配列のインデックスnが配列の長さよりも小さい、もしくは等しいかを判定し(ステップ1508)、小さい、もしくは等しい場合はnに1を加え(ステップ1509)、次の要素への処理に移る。大きい場合は、処理を終了する。
このとき、結果配列に格納されているメソッドデータがパターンにマッチしたものになる。これをユーザインターフェース管理部(208)に送る。
ユーザインターフェース管理部(208)では、この情報を元にクラス図上の対応するメソッドをハイライト表示(強調表示)する。
Next, the array index n is initialized with “1” (step 1503).
Next, the nth element of the candidate sequence is extracted, and it is determined whether or not the class name field matches the class name pattern selected by the user (step 1504). If it matches, the method moves to the method name field. If not, the process for the element is interrupted. Next, it is determined whether or not the method name field matches the method name pattern selected by the user (step 1505). If it matches, move on to the method argument determination. If it does not match, the processing for the element is interrupted.
Next, it is determined whether the method argument field matches the method argument pattern selected by the user (step 1506). If it matches, add the element to the result array. If it does not match, the processing for the element is interrupted.
Next, it is determined whether the index n of the array is smaller than or equal to the length of the array (step 1508). If it is smaller or equal, 1 is added to n (step 1509), and the process proceeds to the next element. . If larger, the process is terminated.
At this time, the method data stored in the result array matches the pattern. This is sent to the user interface management unit (208).
The user interface management unit (208) highlights (highlights) the corresponding method on the class diagram based on this information.

上記の処理を図16に示したデータ例を用いて説明する。
図16(a)の候補配列に対し、メソッド情報(1601)を図3に示した形式で格納する。
次に、候補配列の1番目の要素を取り出し、クラス名フィールドのデータとクラス名パターン(1602)とを照合する。クラス名パターンは「*Dao」であり、これは、「Dao」という文字列で終わる任意の文字列であることを示す。ここでこのデータのクラス名が「LoginDao」であるため、このパターンに当てはまる。
次に、メソッド名フィールドのデータとメソッド名パターン(1603)を照合する。
メソッド名パターンは「find*」であり、これは、「find」という文字列で始まる任意の文字列であることを示す。ここでこのデータのメソッド名が「findUser」であるため、このパターンに当てはまる。
The above processing will be described using the data example shown in FIG.
The method information (1601) is stored in the format shown in FIG. 3 for the candidate sequence of FIG.
Next, the first element of the candidate sequence is extracted, and the data in the class name field is compared with the class name pattern (1602). The class name pattern is “* Dao”, which indicates an arbitrary character string ending with the character string “Dao”. This is the case because the class name of this data is “LoginDao”.
Next, the data in the method name field is collated with the method name pattern (1603).
The method name pattern is “find *”, which indicates an arbitrary character string starting with the character string “find”. Here, the method name of this data is “findUser”, so this pattern is applicable.

次に、引数フィールドのデータと引数パターン(1604)とを照合する。引数パターンは「(..)」であり、これは任意の引数とマッチすることを示す。このパターンはすべての引数の形式にマッチするため、このデータもマッチする。このデータはすべてのパターンにマッチしたため、このデータを結果配列(1605)に格納する。
2番目のデータも同様にすべてのパターンにマッチするため、結果配列(1605)に格納する。
3番目のデータは、クラス名が「LoginService」であるが「Dao」で終わる文字列ではないため、クラス名パターン「*Dao」にマッチしない。そのため、このデータはこれらのパターンにマッチするデータではないため、結果配列(1605)には格納されない。
4番目のデータは、クラス名が「OrderDao」であるため、クラス名パターン「*Dao」にマッチするが、メソッド名が「getOrder」でありfindで始まる文字列ではないため、メソッド名パターン「find*」にマッチしない。そのため、このデータはこれらのパターンにマッチするデータではないため、結果配列(1605)には格納されない。
Next, the argument field data and the argument pattern (1604) are collated. The argument pattern is “(..)”, indicating that it matches any argument. This pattern matches all argument formats, so this data also matches. Since this data matches all patterns, this data is stored in the result array (1605).
Similarly, since the second data matches all patterns, it is stored in the result array (1605).
The third data does not match the class name pattern “* Dao” because the class name is “LoginService” but is not a character string ending with “Dao”. Therefore, since this data is not data that matches these patterns, it is not stored in the result array (1605).
The fourth data matches the class name pattern “* Dao” because the class name is “OrderDao”. However, since the method name is “getOrder” and is not a character string starting with find, the method name pattern “find Does not match "*". Therefore, since this data is not data that matches these patterns, it is not stored in the result array (1605).

このように、図16で示した4つのデータの中から1番目と2番目のデータがこのパターンにマッチしたこととなる。
ここまでで、メソッドに対するアスペクトを設定する手順を説明したが、同様の方法で、コンストラクタに対するアスペクトやフィールドに対するアスペクトも設定することができる。
コンストラクタのデータは、図3のメソッド情報のデータフォーマット形式で格納されている。この際、メソッド名および戻り値はそのクラス名となる。コンストラクタに対するアスペクトは、メソッドに対するアドバイスをアドバイスツールボックスから選択し、クラス図のクラス名が表示されているフィールド(703)にドラッグすることによって設定する。この際、クラス名のパターンのメニューとメソッド引数のパターンのメニューが表示され、これを選択すると、ポイントカット種別を選択するダイアログが表示される。
Thus, the first and second data out of the four data shown in FIG. 16 match this pattern.
Up to this point, the procedure for setting an aspect for a method has been described, but an aspect for a constructor and an aspect for a field can also be set in the same manner.
The constructor data is stored in the data format of the method information shown in FIG. At this time, the method name and the return value are the class name. The aspect for the constructor is set by selecting the advice for the method from the advice toolbox and dragging it to the field (703) in which the class name of the class diagram is displayed. At this time, a class name pattern menu and a method argument pattern menu are displayed. When this is selected, a dialog for selecting a pointcut type is displayed.

コンストラクタのポイントカット種別は、メソッドに対する設定と同様のポイントカット種別に加えて、オブジェクトが初期化されたとき(initialization)とオブジェクトが初期化される前(preinitialization)がある。これを選択することにより、コンストラクタに対するアスペクトが生成される。
フィールドのデータは、図4のフィールド情報のデータフォーマットで格納されている。フィールドに対するアスペクトは、フィールドに対するアドバイスをアドバイスツールボックスから選択し、クラス図のフィールド名が表示されているフィールド(704)にドラッグすることによって設定する。この際、クラス名のパターンのメニューとフィールド名のパターンのメニューが表示され、これを選択すると、図12のダイアログと同じフォーマットかつフィールドに対するポイントカット種別を列挙したダイアログが表示される。
フィールドに対するポイントカット種別には、フィールドへの読み込みアクセスgetとフィールドへの書き込みアクセスsetの2種類がある。これを選択することにより、フィールドに対するアスペクトが生成される。
The pointcut type of the constructor includes a pointcut type similar to the setting for the method, when the object is initialized (initialization), and before the object is initialized (preinitialization). By selecting this, an aspect for the constructor is generated.
The field data is stored in the field information data format of FIG. The aspect for the field is set by selecting the advice for the field from the advice toolbox and dragging it to the field (704) where the field name of the class diagram is displayed. At this time, a class name pattern menu and a field name pattern menu are displayed, and when this is selected, a dialog listing the same format and pointcut types for the fields as the dialog of FIG. 12 is displayed.
There are two types of pointcut types for a field: read access to the field get and write access set to the field. By selecting this, an aspect for the field is generated.

本発明の実施に用いるコンピュータのハードウェア構成図である。It is a hardware block diagram of the computer used for implementation of this invention. 本発明のアスペクト生成装置の機能構成図である。It is a functional block diagram of the aspect production | generation apparatus of this invention. クラスのメソッド情報のデータフォーマットを表す図である。It is a figure showing the data format of the method information of a class. クラスのフィールド情報のデータフォーマットを表す図である。It is a figure showing the data format of the field information of a class. アドバイスデータのデータフォーマットを表す図である。It is a figure showing the data format of advice data. アスペクトのプログラムコードを表す図である。It is a figure showing the program code of an aspect. アスペクト設定装置の画面構成図である。It is a screen block diagram of an aspect setting device. クラス名パターンメニューを表す図である。It is a figure showing a class name pattern menu. メソッド名パターンメニューを表す図である。It is a figure showing a method name pattern menu. メソッド引数パターンメニューを表す図である。It is a figure showing a method argument pattern menu. パターン設定時の画面を表す図である。It is a figure showing the screen at the time of pattern setting. ポイントカット種別を選択するダイアログを表す図である。It is a figure showing the dialog which selects a pointcut classification. ユーザの処理の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of a user's process. クラス名パターンを生成する処理のフローチャートである。It is a flowchart of the process which produces | generates a class name pattern. マッチするメソッドを抽出する処理のフローチャートである。It is a flowchart of the process which extracts the matching method. マッチするメソッドを抽出する処理で用いるデータの例を表す図である。It is a figure showing the example of the data used by the process which extracts the matching method.

符号の説明Explanation of symbols

201 アスペクト生成装置
202 クラス情報解析部
203 クラス蓄積部
204 アドバイス解析部
205 アドバイス蓄積部
206 アスペクト生成部
207 アスペクト蓄積部
DESCRIPTION OF SYMBOLS 201 Aspect generation apparatus 202 Class information analysis part 203 Class storage part 204 Advice analysis part 205 Advice storage part 206 Aspect generation part 207 Aspect storage part

Claims (4)

開発対象のプログラム内で使用されているクラスに共通する処理をアスペクトとして生成するアスペクト生成装置であって、
開発対象のプログラム内で使用されているクラスファイルを第1の記憶手段から読み出し、クラスファイル内の各クラスの構造を解析し、各クラスで使用されているクラス名、メソッド名、シグネチャを取得し、その取得したクラス名、メソッド名、シグネチャに基づき、生成するアスペクトに定義するクラス名、メソッド名、シグネチャの候補を生成するクラス情報解析手段と、
共通処理として切り出すアスペクトが行うアドバイスの候補を第2の記憶手段から読み出し、アドバイスの候補のデータ構造を解析するアドバイス解析手段と、
前記クラス情報解析手段によるクラス構造の解析結果に基づき開発対象のプログラム内で使用されているクラスについてクラス名、メソッド名、シグネチャを明示したクラス図と、前記アドバイス解析手段が解析したアドバイスの候補とをグラフィカルユーザインターフェース画面に表示させるユーザインターフェース管理手段と、
前記グラフィカルユーザインタフェース画面に表示されたアドバイスの候補のうちユーザによって選択された任意のアイコンが前記クラス図中の任意のクラスの位置にドラッグされた場合に、当該クラスにおいて選択可能な、前記クラス情報解析手段によって生成されたクラス名、メソッド名、シグネチャの候補を表示し、ユーザによって選択されたクラス名、メソッド名、シグネチャの候補のデータを、ユーザによって選択されたアドバイスの候補のデータ構造に適用してアスペクトを生成するアスペクト生成手段と
を備えることを特徴とするアスペクト生成装置。
An aspect generation device that generates processing common to classes used in a program to be developed as an aspect,
The class file used in the development target program is read from the first storage means, the structure of each class in the class file is analyzed, and the class name, method name, and signature used in each class are obtained. , Based on the acquired class name, method name, and signature, class information analyzing means for generating a class name, method name, signature candidate defined in the generated aspect;
Advice analysis means for reading out advice candidates performed by the aspect cut out as common processing from the second storage means, and analyzing the data structure of the advice candidates;
A class diagram clearly indicating a class name, a method name, and a signature for a class used in the program to be developed based on the analysis result of the class structure by the class information analysis unit; and a candidate of the advice analyzed by the advice analysis unit; A user interface management means for displaying on a graphical user interface screen;
The class information that can be selected in the class when an arbitrary icon selected by the user among the advice candidates displayed on the graphical user interface screen is dragged to the position of an arbitrary class in the class diagram Displays the class name, method name, and signature candidate generated by the analysis means, and applies the class name, method name, and signature candidate data selected by the user to the advice candidate data structure selected by the user And an aspect generation unit for generating an aspect.
前記アスペクト生成手段は、生成したアスペクトに定義されたクラス名、メソッド名、シグネチャに一致するクラス名、メソッド名、シグネチャを持つクラス図中のクラスのメソッドを強調表示することを特徴とする請求項1に記載のアスペクト生成装置。   The aspect generation means highlights a method of a class in a class diagram having a class name, a method name, a class name matching the signature, a method name, and a signature defined in the generated aspect. 2. The aspect generation apparatus according to 1. 開発対象のプログラム内で使用されているクラスに共通する処理をアスペクトとして生成するアスペクト生成方法であって、
第1の手段により、開発対象のプログラム内で使用されているクラスファイルを第1の記憶手段から読み出し、クラスファイル内の各クラスの構造を解析し、各クラスで使用されているクラス名、メソッド名、シグネチャを取得し、その取得したクラス名、メソッド名、シグネチャに基づき、生成するアスペクトに定義するクラス名、メソッド名、シグネチャの候補を生成する第1のステップと、
第2の手段により、共通処理として切り出すアスペクトが行うアドバイスの候補を第2の記憶手段から読み出し、アドバイスの候補のデータ構造を解析する第2のステップと、
第3の手段により、前記第1の手段によるクラス構造の解析結果に基づき開発対象のプログラム内で使用されているクラスについてクラス名、メソッド名、シグネチャを明示したクラス図と、前記第2の手段が解析したアドバイスの候補とをグラフィカルユーザインターフェース画面に表示させる第3のステップと、
第4の手段により、前記グラフィカルユーザインターフェース画面に表示されたアドバイスの候補のうちユーザによって選択された任意のアイコンが前記クラス図中の任意のクラスの位置にドラッグされた場合に、当該クラスにおいて選択可能な、前記第1の手段によって生成されたクラス名、メソッド名、シグネチャの候補を表示し、ユーザによって選択されたクラス名、メソッド名、シグネチャの候補のデータを、ユーザによって選択されたアドバイスの候補のデータ構造に適用してアスペクトを生成する第4のステップと
を備えることを特徴とするアスペクト生成方法。
An aspect generation method for generating processing common to classes used in a program to be developed as an aspect,
The first means reads the class file used in the program to be developed from the first storage means, analyzes the structure of each class in the class file, and uses the class name and method used in each class. A first step of generating a name, a signature, and generating a class name, a method name, and a signature candidate defined in the generated aspect based on the acquired class name, method name, and signature;
A second step of reading from the second storage means an advice candidate performed by the aspect cut out as a common process by the second means, and analyzing a data structure of the advice candidate;
A class diagram clearly indicating a class name, a method name, and a signature for a class used in the program to be developed based on the analysis result of the class structure by the first means; and the second means. A third step of displaying on the graphical user interface screen the advice candidates analyzed by
When an arbitrary icon selected by the user among the advice candidates displayed on the graphical user interface screen is dragged to the position of an arbitrary class in the class diagram by the fourth means, it is selected in the class. Possible class names, method names, and signature candidates generated by the first means are displayed, and the class name, method name, and signature candidate data selected by the user are displayed for the advice selected by the user. And a fourth step of generating an aspect by applying to a candidate data structure.
前記第4のステップにおいて、生成したアスペクトに定義されたクラス名、メソッド名、シグネチャに一致するクラス名、メソッド名、シグネチャを持つクラス図中のクラスのメソッドを強調表示することを特徴とする請求項3に記載のアスペクト生成方法。   In the fourth step, the class name defined in the generated aspect, the method name, the class name matching the signature, the method name, and the method of the class in the class diagram having the signature are highlighted. Item 4. The aspect generation method according to Item 3.
JP2006035195A 2006-02-13 2006-02-13 Aspect generation method and apparatus Pending JP2007213487A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006035195A JP2007213487A (en) 2006-02-13 2006-02-13 Aspect generation method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006035195A JP2007213487A (en) 2006-02-13 2006-02-13 Aspect generation method and apparatus

Publications (1)

Publication Number Publication Date
JP2007213487A true JP2007213487A (en) 2007-08-23

Family

ID=38491837

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006035195A Pending JP2007213487A (en) 2006-02-13 2006-02-13 Aspect generation method and apparatus

Country Status (1)

Country Link
JP (1) JP2007213487A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011121873A1 (en) * 2010-03-30 2011-10-06 日本電気株式会社 Program processing method, program processing device, and computer program
US9003370B2 (en) 2010-03-04 2015-04-07 Nec Corporation Application modification portion searching device and application modification portion searching method
US9116708B2 (en) 2010-03-05 2015-08-25 Nec Corporation Program creation support apparatus, program, and information system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9003370B2 (en) 2010-03-04 2015-04-07 Nec Corporation Application modification portion searching device and application modification portion searching method
US9116708B2 (en) 2010-03-05 2015-08-25 Nec Corporation Program creation support apparatus, program, and information system
WO2011121873A1 (en) * 2010-03-30 2011-10-06 日本電気株式会社 Program processing method, program processing device, and computer program
US9342382B2 (en) 2010-03-30 2016-05-17 Nec Corporation Program processing method, program processing apparatus, and computer program

Similar Documents

Publication Publication Date Title
US7865870B2 (en) Automatic content completion of valid values for method argument variables
US8539475B2 (en) API backward compatibility checking
JP4395761B2 (en) Program test support apparatus and method
US20100023926A1 (en) Call graph dependency extraction by static source code analysis
US20150347281A1 (en) Automation testing using descriptive maps
Sharp Microsoft Visual C# step by step
US20140019937A1 (en) Updating product documentation using automated test scripts
EP3008585B1 (en) Automatic source code generation
CN108027721B (en) Techniques for configuring a general program using controls
US7519956B2 (en) Method for generating document components and managing same
US10635434B2 (en) Annotating generator output stream with source code information of the generator
US9053234B2 (en) Collapsible stack trace
US20170300305A1 (en) Executable guidance experiences based on implicitly generated guidance models
KR20140071292A (en) The Visual Spring Development Environment System for Visualizing Application Architecture and Method Call Sequence
US20090132994A1 (en) Automation tool and method for generating test code
US10229096B1 (en) Automatic generation of a presentation from code based on analysis of an intermediate version of the code
US7966562B1 (en) System and method for providing domain-sensitive help
JP2007213487A (en) Aspect generation method and apparatus
US20090217254A1 (en) Application level smart tags
Vasic Mastering Android Development with Kotlin: Deep dive into the world of Android to create robust applications with Kotlin
Cuenca et al. A domain-specific textual language for rapid prototyping of multimodal interactive systems
Canny et al. Model-based testing of post-wimp interactions using object oriented petri-nets
JP4974228B2 (en) Aspect setting method and apparatus, and computer program
JP2014106770A (en) Type check device, type check method and type check program
JP2008071007A (en) Aspect analyzing method and device, and computer program