Skip to content

Commit

Permalink
Add HolderImpl to allow wrapping arguments by one sequence or attribu…
Browse files Browse the repository at this point in the history
…te contained in it
  • Loading branch information
Nirostar committed Apr 8, 2022
1 parent 2e72921 commit 8450aa8
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Auto generated
package org.dcm4che.typeddicom.dataelements;

import org.dcm4che.typeddicom.AbstractAttributesWrapper;
import org.dcm4che.typeddicom.AttributesWrapper;
{{#sequence}}
import org.dcm4che.typeddicom.AbstractSequenceItemWrapper;
Expand Down Expand Up @@ -75,6 +76,14 @@ public class {{keyword}} extends {{#sequence}}SequenceWrapper<{{keyword}}.Item>{
* A class implementing this interface can hold attributes which contain the DICOM tag "{{name}}" (see {@link {{keyword}}})
*/
public interface Holder extends AttributesWrapper {
/**
*
* @param attributes An attributes object containing the {{name}} (see {@link {{keyword}}})
* @return A wrapper object implementing the {@link Holder} interface.
*/
static Holder wrap(Attributes attributes) {
return AttributesWrapper.wrap(attributes, HolderImpl.class);
}

/**
*
Expand Down Expand Up @@ -114,7 +123,7 @@ public class {{keyword}} extends {{#sequence}}SequenceWrapper<{{keyword}}.Item>{

{{/sequence}}
/**
* @return Whether it contains a {{name}} (see {@link {{keyword}}})
* @return Whether it contains the {{name}} (see {@link {{keyword}}})
*/
default boolean contains{{keyword}}() {
return getAttributes().contains(TAG);
Expand All @@ -127,4 +136,10 @@ public class {{keyword}} extends {{#sequence}}SequenceWrapper<{{keyword}}.Item>{
getAttributes().remove(TAG);
}
}

private static class HolderImpl extends AbstractAttributesWrapper implements Holder {
private HolderImpl(Attributes attributes) {
super(attributes);
}
}
}

0 comments on commit 8450aa8

Please sign in to comment.