- edited description
Add support for implementation classes
Allow user to create implementation classes. Implementation classes should represent a class from the Java library or any other framework. In order to not clatter the UI too much, we will only show the operations the user wants to use.
Possible workflow:
- Use same way as creating a new class, but show an option to decide whether to create a class or implementation class
- Present a list of classes and allow to search
- Allow to "edit" the implementation class: Allow to add operations, but show a list of available operations.
Open questions:
- How to add classes from third-party libraries?
- Should it be possible to convert a class to an implementation class: For example, a user might have a class in the design that represents the concept of a class from a Java or a library. The tool could advice the user and allow to transform it to an implementation class.
Problems to resolve:
- When an implementation class is imported and the used operation has a return type or parameter types of other classes (from Java or a library), then that class has to be imported as well.
Comments (15)
-
reporter -
reporter - attached ca.mcgill.sel.ram.importer.zip
The attached code is a test to see how external classes can be imported. It uses the reflections library: https://code.google.com/p/reflections/
With it, either classes from a .jar file or Java can be imported. An open problem is, that the parameter names are not part of the .class files. If we want proper parameter names, we need to use the source files and somehow get the names of parameters (Eclipse does it somehow).
-
reporter -
assigned issue to
-
assigned issue to
-
I believe that eclipse does this by looking at the javadocs. (I did some tests) It's something that we could do but I find that asking the jar javadocs would be annoying to the user.
-
reporter Are interfaces currently supported? For example, if we want to use
Runnable
orList
etc.We probably have to add interfaces to the metamodel to support it (issue
#42). -
I just realized that the SelectorView is also displaying interfaces. The problem is that I have no way of knowing if it is an interface because I am getting the list of classes by looking at the filenames of all the .class files in the .jar. What I would have to do is to load every single class and check if it's a class or not, before displaying them in the SelectorView, but it would only work if I only have a small number of class to load (not 2000 classes).
-
reporter Do you mean you only take the filenames and display them (as String)? Meaning you don't have a
Class
instance at that point?I guess that's not a problem since when you load it you should get a
Class
instance which would allow you to find out if its an interface (there is a method for that). Except if we want to show already in the selector if it's a class or an interface. -
reporter How long does it take your implementation to read all the java classes?
I just did a quick test when using the reflections framework mentioned above. It loads 5665 java classes (all subtypes of Object in packages that start with java. or javax.) in ~1.2 seconds. They are instances of
java.lang.Class
so it is easy to figure out different properties.This is the code I used:
Reflections reflections = new Reflections(ClasspathHelper.forClass(Object.class), new Predicate<String>() { @Override public boolean apply(String name) { return name.startsWith("java.") || name.startsWith("javax."); } }, new SubTypesScanner(false)); Set<?> allClasses = reflections.getSubTypesOf(Object.class);
-
reporter One last thing ;)
We can define the body of the getName operation for
ImplementationClass
using OCL directly in the metamodel. That way all we would have to do is set theinstanceClassName
attribute. That way it is kind of derived ...Let me know and I can take care of that.
-
I made a mistake. My implementation loads 5000 classes very fast. I thought I was lagging because of the number of classes but, in fact, I was getting system errors that was crashing my program. I found another problem where I am Out of Memory at about 11111 classes. I want to rewrite my class loader so that I can actually unload classes when I don't need them. (and also do some caching of the list of classes). I think I will need a getName operation so that I can know if the class is already in the view. So if you can do it, it would be appreciated!
-
reporter - changed milestone to AOSD 2014 Demo
-
- changed status to resolved
Resolved issue
#73: Added EnumView, EnumController,...Resolved issue
#34: Added ImplementationClassView, ImplementationClassController,...Resolved issue
#54: Added associations between any classifiers→ <<cset 880ae84d3652>>
-
reporter References issue
#34: Keyboard is also displayed immediately when a constructor or operation is added.→ <<cset 05eea9609bf2>>
-
reporter References issue
#34: Increased the minimum number of characters that are required to be entered before a search is started.Previously, in commit 671b6ab, the max shown recommendations were disabled and all found classes for a search were added, because the selector is scrollable.
However, when typing in, for example, "da", there will be ~1200 results and all will be added to the selector, i.e., 1200 text components are added. This can lead to a memory/heap problem and the UI also acts slow.
→ <<cset 2c6923cb32ec>>
-
reporter Maybe the selector should only actually create text components for a certain amount and create the rest on the fly? Is this feasible, @tdimeco, @lmartellotto?
- Log in to comment