package aspects; import mixconfig.tools.dataretention.smartcard.commands.AbstractCommand; /** * Makes some protected fields accessable with a getter. * * @author christoph * */ public privileged aspect AbstractCommandAspect { public byte[] AbstractCommand.getBytes() { int length = 4; if (arguments.length > 0) { length += arguments.length + 1; } if (expectedReturnDataLength > 0) { length += 1; } byte[] bytes = new byte[length]; bytes[0] = apduClass; bytes[1] = instruction; bytes[2] = p1; bytes[3] = p2; if (arguments.length > 0) { bytes[4] = (byte) arguments.length; for (int i = 0; i < arguments.length; i++) { bytes[i + 5] = arguments[i]; } } if (expectedReturnDataLength > 0) { bytes[bytes.length - 1] = expectedReturnDataLength; } return bytes; } }