| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A creator of new source code parts of the model with default contents/properties.
Automatically set properties for created objects
are dictated by the language standards and common sense (for example, attributes are made private).
After creation (see example), a newly created element can be pasted into SciContainer using the
paste method.
An instance of SciFactory for a specific language can be obtained using
SciModel.getFactory(String lagnuage) method.
There is a similar interface called SciGenericFactory
which also creates new source code parts of the model,
but it creates them based on the string with the text of the member you want to create.
| Method Summary | |
SciAttribute | newAttribute()Creates a new SciAttribute with a set of default properties (private, int). |
SciClass | newClass()Creates a new SciClass with a set of default properties. |
SciCodeBlock | newCodeBlock()Creates a new empty SciCodeBlock. |
SciFile | newFile()Creates a new empty SciFile with a set of default properties. |
SciInheritance | newInheritance()Creates a new SciInheritance. |
SciJavaImport | newJavaImport()Creates a new SciJavaImport. |
SciMemberDefinition | newMemberDefinition(SciMember sciMember)Creates a new SciMemberDefinition for a given SciMember. |
SciOperation | newOperation()Creates a new SciOperation with a set of default properties (public, void, no parameters). |
SciPackage | newPackage()Creates a new SciPackage. |
SciParameter | newParameter()Creates a new SciParameter with a set of default properties. |
SciTag | newTag()Creates a new SciTag. |
SciThrowSpecifier | newThrowSpecifier()Creates a new SciThrowSpecifier. |
| Method Detail |
public SciAttribute newAttribute()
SciAttribute with a set of default properties (private, int). For example:
SciAttribute newAttribute = SciModelAccess.getModel().getFactory(SciLanguage.JAVA).newAttribute(); //creating a new attribute with default name and type
newAttribute.setName("myLastName"); //setting the name
newAttribute.getType().setText("String"); //setting the type
newAttribute.setProperty(SciProperty.PUBLIC, true); //setting the public modifier
someSciClass.paste(newAttribute, null, false); //pasting it into someSciClass
someSciClassSciAttribute with a set of default propertiespublic SciClass newClass()
SciClass with a set of default properties.SciClass with a set of default propertiespublic SciCodeBlock newCodeBlock()
SciCodeBlock.SciCodeBlockpublic SciFile newFile()
SciFile with a set of default properties.
SciFile f = SciModelAccess.getModel().getFactory(SciLanguage.JAVA).newFile();
f.setName("R.java"); //setting the name
someSciPackage.paste(f,null,false);
SciFile with a set of default propertiespublic SciInheritance newInheritance()
SciInheritance.SciInheritancepublic SciJavaImport newJavaImport()
SciJavaImport. For Java language only.SciJavaImportpublic SciMemberDefinition newMemberDefinition(SciMember sciMember)
SciMemberDefinition for a given SciMember. For C++ language only.SciMemberDefinitionpublic SciOperation newOperation()
SciOperation with a set of default properties (public, void, no parameters).
SciOperation newOperation = SciModelAccess.getModel().getFactory(SciLanguage.JAVA).newOperation(); //creating a new operation with default name, parameters and return type
newOperation.setName("getSalary"); //setting the name
newOperation.getReturnType().setText("int"); //setting the return type
newOperation.getParameterList().setText("String lastName, int year"); //setting the parameters
newOperation.setProperty(SciProperty.PROTECTED, true); //setting the protected modifier
someSciClass.paste(newOperation, null, false); //pasting it into someSciClass
protected int getSalary(String lastName, int year){}
someSciClass.
SciOperation with a set of default propertiespublic SciPackage newPackage()
SciPackage.public SciParameter newParameter()
SciParameter with a set of default properties.SciParameter with a set of default propertiespublic SciTag newTag()
SciTag.SciTagpublic SciThrowSpecifier newThrowSpecifier()
SciThrowSpecifier.SciThrowSpecifier
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||