use of org.eclipse.titan.designer.AST.TTCN3.types.SignatureGenerator.signatureParamaterDirection in project titan.EclipsePlug-ins by eclipse.
the class Signature_Type method generateCode.
@Override
public /**
* {@inheritDoc}
*/
void generateCode(final JavaGenData aData, final StringBuilder source) {
final String genName = getGenNameOwn();
final ArrayList<SignatureParameter> parameters = new ArrayList<SignatureParameter>();
for (int i = 0; i < formalParList.getNofParameters(); i++) {
final SignatureFormalParameter formalPar = formalParList.getParameterByIndex(i);
final Type type = formalPar.getType();
SignatureGenerator.signatureParamaterDirection direction;
switch(formalPar.getDirection()) {
case PARAM_OUT:
direction = signatureParamaterDirection.PAR_OUT;
break;
case PARAM_INOUT:
direction = signatureParamaterDirection.PAR_INOUT;
break;
default:
direction = signatureParamaterDirection.PAR_IN;
break;
}
final SignatureParameter temp = new SignatureParameter(direction, type.getGenNameValue(aData, source, myScope), type.getGenNameTemplate(aData, source, myScope), formalPar.getIdentifier().getName());
parameters.add(temp);
}
SignatureReturnType signatueReturnType = null;
if (returnType != null) {
signatueReturnType = new SignatureReturnType(returnType.getGenNameValue(aData, source, myScope), returnType.getGenNameTemplate(aData, source, myScope));
}
final ArrayList<SignatureException> signatureExceptions = new ArrayList<SignatureGenerator.SignatureException>();
if (exceptions != null) {
for (int i = 0; i < exceptions.getNofExceptions(); i++) {
final Type exceptionType = exceptions.getExceptionByIndex(i);
final IType last = exceptionType.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
final SignatureException temp = new SignatureException(last.getGenNameValue(aData, source, myScope), last.getGenNameTemplate(aData, source, myScope), last.getFullName());
signatureExceptions.add(temp);
}
}
final SignatureDefinition def = new SignatureDefinition(genName, getFullName(), parameters, signatueReturnType, noBlock, signatureExceptions);
SignatureGenerator.generateClasses(aData, source, def);
if (hasDoneAttribute()) {
generateCodeDone(aData, source);
}
if (subType != null) {
subType.generateCode(aData, source);
}
generateCodeForCodingHandlers(aData, source);
}
Aggregations