Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frascati
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
114
Issues
114
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frascati
frascati
Commits
fc3e70bc
Commit
fc3e70bc
authored
Jan 19, 2017
by
Lionel Seinturier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor as a class generator.
parent
4de02e2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
57 deletions
+6
-57
tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/tinfilet/EmptySubClassGenerator.java
...g/ow2/frascati/tinfi/tinfilet/EmptySubClassGenerator.java
+6
-57
No files found.
tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/tinfilet/EmptySubClassGenerator.java
View file @
fc3e70bc
...
...
@@ -23,22 +23,15 @@
package
org.ow2.frascati.tinfi.tinfilet
;
import
java.io.IOException
;
import
java.lang.reflect.Modifier
;
import
java.util.Date
;
import
org.objectweb.fractal.juliac.api.SourceCodeGeneratorItf
;
import
org.objectweb.fractal.juliac.visit.ClassSourceCodeVisitor
;
import
org.objectweb.fractal.juliac.visit.FileSourceCodeVisitor
;
import
org.objectweb.fractal.juliac.opt.ClassGenerator
;
/**
* Generate an empty class which extends the one specified in the constructor.
* This generator is used by Tinfi.
* Generate an empty class that extends the one specified in the constructor.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.3.1
*/
public
class
EmptySubClassGenerator
implements
SourceCodeGeneratorItf
{
public
class
EmptySubClassGenerator
extends
ClassGenerator
{
/**
* @param targetname the fully-qualified name of the class to be generated
...
...
@@ -52,56 +45,12 @@ public class EmptySubClassGenerator implements SourceCodeGeneratorItf {
private
String
targetname
;
private
String
superclname
;
/**
* Return the name of the class generated by this generator.
*/
public
String
getTargetTypeName
()
{
return
targetname
;
}
/**
* Generate the header of the source code file associated with this
* generator. The header is the section which precedes the source code of
* the class. The header may be composed of an initial comment, the
* declaration of the package name and some import clauses.
*
* @param fv the visitor for generating the header of the source code file
*/
public
void
generate
(
FileSourceCodeVisitor
fv
)
throws
IOException
{
int
lastdot
=
targetname
.
lastIndexOf
(
'.'
);
String
packagename
=
(
lastdot
==-
1
)
?
null
:
targetname
.
substring
(
0
,
lastdot
);
/*
* File header.
*/
fv
.
visitFileHeader
(
"/*"
);
fv
.
visitFileHeader
(
" * Generated by "
+
getClass
().
getName
()+
" on: "
+
new
Date
());
fv
.
visitFileHeader
(
" */"
);
/*
* Package.
*/
if
(
packagename
!=
null
)
{
fv
.
visitPackageName
(
packagename
);
}
/*
* Class.
*/
ClassSourceCodeVisitor
cv
=
fv
.
visitPublicClass
();
generate
(
cv
);
}
/**
* Generate the source code of the class associated with this generator.
*
* @param cv the visitor for generating the source code of the class
*/
public
void
generate
(
ClassSourceCodeVisitor
cv
)
{
int
lastdot
=
targetname
.
lastIndexOf
(
'.'
);
String
classname
=
targetname
.
substring
(
lastdot
+
1
);
cv
.
visit
(
Modifier
.
PUBLIC
,
classname
,
null
,
superclname
,
null
);
cv
.
visitEnd
();
@Override
public
String
getSuperClassName
()
{
return
superclname
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment