public Model translate( Reader reader, String inputType, Properties parameters ) throws ModelloException { throw new ModelloRuntimeException( "Not implemented." ); }
public void saveModel( Model model, Writer writer ) throws ModelloException { throw new ModelloRuntimeException( "Not implemented." ); }
/** * Decreases the indent level by 1 **/ public void unindent() { if ( currentIndent == 0 ) { throw new ModelloRuntimeException( "Cannot unindent: current indent is 0." ); } currentIndent -= indentSize; } //-- unindent
public ModelField getField( String type, VersionRange versionRange ) { throw new ModelloRuntimeException( "There are no field '" + type + "' in an interface." ); }
protected String getParameter( Properties parameters, String name ) { String value = parameters.getProperty( name ); if ( value == null ) { throw new ModelloRuntimeException( "Missing parameter '" + name + "'." ); } return value; }
public T getPlugin( String name ) { T plugin = plugins.get( name ); if ( plugin == null ) { throw new ModelloRuntimeException( "No such plugin: " + name ); } return plugin; }
protected <T extends Metadata> T getMetadata( Class<T> type, String key ) { Metadata metadata = this.metadata.get( key ); if ( metadata == null ) { throw new ModelloRuntimeException( "No such metadata: '" + key + "' for element: '" + getName() + "'." ); } if ( !type.isInstance( metadata ) ) { throw new ModelloRuntimeException( "The metadata is not of the expected type. Key: '" + key + "', expected type: '" + type.getName() + "'." ); } return type.cast( metadata ); }
public MetadataPlugin getMetadataPlugin( String metadataId ) { MetadataPlugin metadata = getPlugin( metadataId ); if ( metadata == null ) { throw new ModelloRuntimeException( "No such metadata plugin: '" + metadataId + "'." ); } return metadata; }
public ModelloGenerator getGeneratorPlugin( String generatorId ) { ModelloGenerator generator = getPlugin( generatorId ); if ( generator == null ) { throw new ModelloRuntimeException( "No such generator plugin: '" + generatorId + "'." ); } return generator; }
throw new ModelloRuntimeException( "Syntax error in the version field: Missing. " ); throw new ModelloRuntimeException( "Syntax error in the <version> field: The field must be at more 3 parts long (major, minor and micro). Was: '" + version + "'." ); throw new ModelloRuntimeException( "Invalid version string: '" + version + "'." );
public void generate( Model model, String outputType, Properties parameters ) throws ModelloException { if ( model == null ) { throw new ModelloRuntimeException( "Illegal argument: model == null." ); } if ( outputType == null ) { throw new ModelloRuntimeException( "Illegal argument: outputType == null." ); } if ( parameters == null ) { parameters = new Properties(); } ModelloGenerator generator = generatorPluginManager.getGeneratorPlugin( outputType ); generator.generate( model, parameters ); } }
public ModelClass getClass( String type, VersionRange versionRange ) { ModelClass value = getModelClass( type, versionRange ); if ( value != null ) { return value; } throw new ModelloRuntimeException( "There is no class '" + type + "' in the version range '" + versionRange.toString() + "'." ); }
public ModelInterface getInterface( String type, VersionRange versionRange ) { ModelInterface value = getModelInterface( type, versionRange ); if ( value != null ) { return value; } throw new ModelloRuntimeException( "There is no interface '" + type + "' in the version range '" + versionRange.toString() + "'." ); }
public void addInterface( String modelInterface ) { if ( getInterfaces().contains( modelInterface ) ) { throw new ModelloRuntimeException( "Duplicate interface in " + getName() + ": " + modelInterface + "." ); } getInterfaces().add( modelInterface ); }
public ModelDefault getDefault( String key ) { ModelDefault modelDefault = (ModelDefault) defaultMap.get( key ); if ( modelDefault == null ) { try { modelDefault = ModelDefault.getDefault( key ); } catch ( ModelValidationException mve ) { throw new ModelloRuntimeException( mve.getMessage(), mve ); } } return modelDefault; }
public void addDefault( ModelDefault modelDefault ) { if ( defaultMap.containsKey( modelDefault.getKey() ) ) { throw new ModelloRuntimeException( "Duplicate default: " + modelDefault.getKey() + "." ); } getDefaults().add( modelDefault ); defaultMap.put( modelDefault.getKey(), modelDefault ); }
public ModelClass getClass( String type, VersionRange versionRange, boolean optionnal ) { ModelClass value = getModelClass( type, versionRange ); if ( value != null ) { return value; } if ( optionnal ) { return null; } throw new ModelloRuntimeException( "There is no class '" + type + "' in the version range '" + versionRange.toString() + "'." ); }
throw new ModelloRuntimeException( "There are more than one class as root element for this version " + version + "." ); throw new ModelloRuntimeException( "There aren't root element for version " + version + "." );
public ModelType getType( String type, VersionRange versionRange ) { ModelType value = getModelClass( type, versionRange ); if ( value != null ) { return value; } value = getModelInterface( type, versionRange ); if ( value != null ) { return value; } throw new ModelloRuntimeException( "There is no class or interface '" + type + "' in the version range '" + versionRange.toString() + "'." ); }
public void addInterface( ModelInterface modelInterface ) { if ( interfaceMap.containsKey( modelInterface.getName() ) ) { List<ModelInterface> interfaceList = interfaceMap.get( modelInterface.getName() ); for ( ModelInterface currentInterface : interfaceList ) { if ( VersionUtil.isInConflict( modelInterface.getVersionRange(), currentInterface.getVersionRange() ) ) { throw new ModelloRuntimeException( "Duplicate interface: " + modelInterface.getName() + "." ); } } } else { List<ModelInterface> interfaceList = new ArrayList<ModelInterface>(); interfaceMap.put( modelInterface.getName(), interfaceList ); } getAllInterfaces().add( modelInterface ); interfaceMap.get( modelInterface.getName() ).add( modelInterface ); }