[rules-users] Rule Compilation error when using custom classloader

M. Kramer maxkramer at web.de
Mon Apr 2 10:25:01 EDT 2012


Hello,

could it be that the same rules compile with the standard classloader but
not with a custom one because of "declared types"? I found some pointers to
this in older posts but got no clue what it is or how I can use it to get my
apparently correct rules to compile. Any ideas?

Thanks,

M. Kramer



P.S. In case you consider my example incomplete because the code for the
business class State is missing: it is the plain code that is generated by
EMF for a metaclass with a single String attribute name:

public interface State extends EObject
{
  String getName();
  void setName(String value);
}

public class StateImpl extends EObjectImpl implements State
{
  protected static final String NAME_EDEFAULT = null;

  protected String name = NAME_EDEFAULT;

  protected StateImpl()
  {
    super();
  }

  @Override
  protected EClass eStaticClass()
  {
    return LtsPackage.Literals.STATE;
  }

  public String getName()
  {
    return name;
  }

  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET,
LtsPackage.STATE__NAME, oldName, name));
  }

  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LtsPackage.STATE__NAME:
        return getName();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LtsPackage.STATE__NAME:
        setName((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LtsPackage.STATE__NAME:
        setName(NAME_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LtsPackage.STATE__NAME:
        return NAME_EDEFAULT == null ? name != null :
!NAME_EDEFAULT.equals(name);
    }
    return super.eIsSet(featureID);
  }

  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(')');
    return result.toString();
  }

}


--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Compilation-error-when-using-custom-classloader-tp3824716p3877839.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list