public Model loadModel( Reader reader ) throws ModelloException, ModelValidationException { ModelReader modelReader = new ModelReader(); Model model = modelReader.loadModel( reader ); model.initialize(); // keep backward compatibility with Modello attributes model changes upgradeModelloModel( modelReader, model ); handlePluginsMetadata( modelReader, model ); validate( model ); return model; }
if ( parseBaseElement( model, parser ) ) parseDefaults( model, parser ); parseVersionDefinition( model, parser ); parseInterfaces( model, parser ); parseClasses( model, parser ); modelAttributes = getAttributes( parser );
private void upgradeModelloModel( ModelReader modelReader, Model model ) Map<String, String> modelAttributes = modelReader.getAttributesForModel(); Map<String, String> classAttributes = modelReader.getAttributesForClass( clazz ); Map<String, String> fieldAttributes = modelReader.getAttributesForField( field ); Map<String, String> associationAttributes = modelReader.getAttributesForAssociation( (ModelAssociation)field ); Map<String, String> fieldAttributes = modelReader.getAttributesForField( field ); fieldAttributes.put( "xml.content", "true" );
Map<String, String> attributes = getAttributes( parser ); if ( parseBaseElement( modelClass, parser ) ) parseClassInterfaces( modelClass, parser ); parseFields( modelClass, parser ); parseCodeSegment( modelClass, parser );
Map<String, String> attributes = getAttributes( parser ); if ( parseBaseElement( modelInterface, parser ) ) parseCodeSegment( modelInterface, parser );
Map<String, String> fAttributes = getAttributes( parser ); if ( parseBaseElement( modelField, parser ) ) aAttributes = getAttributes( parser ); modelAssociation = parseAssociation( parser );
private ModelAssociation parseAssociation( XmlPullParser parser ) throws XmlPullParserException, IOException { ModelAssociation modelAssociation = new ModelAssociation(); while ( parser.nextTag() == XmlPullParser.START_TAG ) { if ( parseBaseElement( modelAssociation, parser ) ) { } else if ( "type".equals( parser.getName() ) ) { modelAssociation.setTo( parser.nextText() ); } else if ( "multiplicity".equals( parser.getName() ) ) { modelAssociation.setMultiplicity( parser.nextText() ); } else { parser.nextText(); } } return modelAssociation; }
private void parseCodeSegment( ModelInterface modelInterface, XmlPullParser parser ) throws XmlPullParserException, IOException { while ( parser.nextTag() == XmlPullParser.START_TAG ) { if ( "codeSegment".equals( parser.getName() ) ) { CodeSegment codeSegment = new CodeSegment(); while ( parser.nextTag() == XmlPullParser.START_TAG ) { if ( parseBaseElement( codeSegment, parser ) ) { } else if ( "code".equals( parser.getName() ) ) { codeSegment.setCode( parser.nextText() ); } else { parser.nextText(); } } modelInterface.addCodeSegment( codeSegment ); } else { parser.next(); } } }
Map<String, String> attributes = modelReader.getAttributesForModel(); Map<String, String> attributes = modelReader.getAttributesForClass( clazz ); Map<String, String> fieldAttributes = modelReader.getAttributesForField( modelAssociation ); Map<String, String> associationAttributes = modelReader.getAttributesForAssociation( modelAssociation ); attributes = modelReader.getAttributesForField( field ); Map<String, String> attributes = modelReader.getAttributesForInterface( iface );
private void parseCodeSegment( ModelClass modelClass, XmlPullParser parser ) throws XmlPullParserException, IOException { while ( parser.nextTag() == XmlPullParser.START_TAG ) { if ( "codeSegment".equals( parser.getName() ) ) { CodeSegment codeSegment = new CodeSegment(); while ( parser.nextTag() == XmlPullParser.START_TAG ) { if ( parseBaseElement( codeSegment, parser ) ) { } else if ( "code".equals( parser.getName() ) ) { codeSegment.setCode( parser.nextText() ); } else { parser.nextText(); } } modelClass.addCodeSegment( codeSegment ); } else { parser.next(); } } }