String resourceType = producerOrConsumerType.substring(0, producerOrConsumerType.lastIndexOf("Consumer")); sensorClassName = resourceType + "InFlowRateSensorImpl"; actuatorClassName = resourceType + "InFlowRateActuatorImpl";
String classResourceName = producerOrConsumerType.substring(0, producerOrConsumerType.lastIndexOf("Consumer")); sensorClassName = sensorPackageName + "." + classResourceName + "InFlowRateSensorImpl"; actuatorClassName = actuatorPackageName + "." + classResourceName + "InFlowRateActuatorImpl";
    private void computeSenorAndActutorNames(Class producerOrConsumerClass) {        String className = producerOrConsumerClass.getSimpleName();        String producerOrConsumerType = className.substring(0, className.lastIndexOf("Operations"));        String sensorClassName = "";        String actuatorClassName = "";                //construct package names                //contruct class names        if (producerOrConsumerType.contains("Producer")){            String resourceType = producerOrConsumerType.substring(0, producerOrConsumerType.lastIndexOf("Producer"));            sensorClassName = resourceType + "OutFlowRateSensorImpl";            actuatorClassName = resourceType + "OutFlowRateActuatorImpl";        }        else{            String resourceType = producerOrConsumerType.substring(0, producerOrConsumerType.lastIndexOf("Consumer"));            sensorClassName = resourceType + "InFlowRateSensorImpl";            actuatorClassName = resourceType + "InFlowRateActuatorImpl";        }        try {            mySensorClass =  Class.forName(sensorClassName);            myActuatorClass = Class.forName(actuatorClassName);        }        catch (ClassNotFoundException e) {            e.printStackTrace();        }    }