Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a set of Java classes that faithfully realizes a set of UML class diagram

ID: 3530956 • Letter: C

Question

Create a set of Java classes that faithfully realizes a set of UML class diagrams. This means you will define classes with the appropriate attributes and operations. You will not, however, need to fully implement the methods; rather, you will use method stubs (described below). In the end you will have code that compiles but does not execute. The class diagrams are available in the document, Library Asset Manager Design.You are permitted to use other classes included in the libraries of Java 6 Standard Edition. Your source code must meet the class coding standards. Method Stubs When implementing a class it's often useful to establish interfaces before providing implementations. This ensures that the classes are correctly declared and as you implement operations the source code will compile. One of the rules of Java is that if a operation has a non-void return type, the method must return a value of that type. If it doesn't, a compiler error occurs. For example, the following will not compile since an int value should be returned: int doSomething() { } If the initial goal is compilation, we stub the operation by returning a value. So, int doSomething() { return 0; } Choosing a value to be returned from the stub depends on the situation and how the operation is being used. When testing the stub may be changed to test the different functionalities of the caller. For the purposes of this assignment the actual value doesn't matter provided it is of the appropriate type.

Explanation / Answer

Sometimes you need to force UML Lab to rebuild its model and resynchronize its model with the actual code.

Sometimes information gets orphaned in the UML Lab model file (XXX.uml) and removing those orphaned items cansometimesalleviate model errors.

Editing the model file is risky! You can easily damage your code if something is done incorrectly. Always commit your project BEFORE attempting to edit the model file! Do not generate code if there are large errors occurring!

Open the model file and fully expand the first section, which should be labelled: "platform/resource/..." Delete the following items:

You will want toreload the modelat this point.

Missing getters and setters in the UML Diagram and seemingly incorrect field visibility

By default, UML Lab does not show the getters and setters for fields in the UML diagram. The visibility shown for the field is the visibility of the getter and setter, not the visibility of the field.

Sometimes, if the getter and/or setter was coded by hand, UML Lab may not recognize it as being associated with the field and thus will display it.

Error: "The association "" is defect: At least two member endsa re required"

This error seems to arise when association lines are somehow "orphaned" in UML Lab's model.

A technique that seems to have some success in getting rid of those errors is to open the model (XXX.uml) file and search through it looking for and deleting Association definitions that don't have any information associated with them. After you are done, follow the directions above to reload the model. See the above instructions oncleaning up the model.

A more drastic measure is to delete the model and class diagram and recreate it.

Ref:http://forum.yatta.de/discussion/36/error-the-association-is-defect-at-least-two-member-ends-are-required

"Error: "This element is not resolved and no code will be generated for it (depends on the chosen templates). Substitute occurrences with the correct element."

This error seems to come from orphaned fields, etc in the model.

Either remake the model and diagram or see the above instructions oncleaning up the model.

Certain types of fields do not show up as association lines

UML Labs only recognizes certain types of fields, a restriction that is particularly apparent when working with generic collections, such as ArrayLists. For instance, suppose you made a field like such, in perfectly legal Java syntax:

private ArrayList<MyData> data = new ArrayList<MyData>();

If you had a UML diagram that already had theMyDataclass on it, an association line pointing atMyDatawould not appear.

The problem is that UML Lab does not recognize theArrayListas a generic collection type. The type that UML Lab understands is the top-level interface for array-type collections, List. Thus the following code works and shows the association line in the UML diagram:

private List<MyData> data = new ArrayList<MyData>();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote