All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.opitzconsulting.orcas.extensions.BaseMultiExtensions Maven / Gradle / Ivy

Go to download

orcas custom extensions (contains only support classes and an empty-extension). If custom-extensions are provided, there will be a custom artifact.

The newest version!
package de.opitzconsulting.orcas.extensions;

import java.util.ArrayList;
import java.util.List;

import de.opitzconsulting.orcasDsl.Model;

public abstract class BaseMultiExtensions extends OrcasBaseExtensionWithParameter
{
  private List _extensions = new ArrayList();
  private boolean useReverseExtension = false;

  protected void addExtension( OrcasExtension pExtension )
  {
    _extensions.add( pExtension );
  }

  public Model transformModel( Model pModel )
  {
    Model lModel = pModel;

    for( OrcasExtension lOrcasExtension : getExtensions() )
    {
      if( lOrcasExtension instanceof OrcasExtensionWithParameter )
      {
        ((OrcasExtensionWithParameter)lOrcasExtension).setParameter( getParameterAsString() );
      }

      lModel = lOrcasExtension.transformModel( lModel );
    }

    return lModel;
  }

  private List getExtensions()
  {
    List lReturn = new ArrayList();

    for( OrcasExtension lOrcasExtension : _extensions )
    {
      if( isReverseExtension( lOrcasExtension ) == useReverseExtension )
      {
        lReturn.add( lOrcasExtension );
      }
    }

    return lReturn;
  }

  private boolean isReverseExtension( OrcasExtension pOrcasExtension )
  {
    return pOrcasExtension instanceof OrcasReverseExtension;
  }

  public boolean hasExtension()
  {
    return !getExtensions().isEmpty();
  }

  public void setUseReverseExtension( boolean pUseReverseExtension )
  {
    useReverseExtension = pUseReverseExtension;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy