HAPI using a custom profile, valueSet and codeSystem

new to the FHIR world, I currently struggle to understand how to work with custom profiles with HAPI FHIR.

Here is a small example to be able to formulate my question afterwards:

The profile I am trying to implement is based on hl7.org/fhir/StructureDefinition/Device and differs from the standard profile: The element Device.type has a required binding to a custom ValueSet which includes a CodeSystem defining CODE_1, CODE_2 and CODE_3. Device.type must be supported and min value=“1”.

Without any effort I could create my new Device object:

Device device1 = new Device();
new Coding().setSystem("http://hl7.org/fhir/CodeSystem/MyCodeSystemForDevices")

But, looking for the most elegant way, when creating a new object the following comes to mind:

My profile is based on hl7.org/fhir/StructureDefinition/Device, so I created a new class which inherits from org.hl7.fhir.r4.model.Device :

@ResourceDef(name = "Device", profile = "http://hl7.org/fhir/profiles/my-custom-device")
public class MyCustomDevice extends Device {

When creating my new Device object, I want set the Device.type by an Enumeration:

CustomDevice device1 = new CustomDevice();

And here I struggle. Do I need to override the function setType in class Device? It gets handed an CodeableConcept. Do I need to implement MyCodeSystemForDevices with my Codes inheriting from CodeableConcept?

I am grateful for any advice, probably I think too complicated.

Thank you in advance,