public class LsOperationResult implements OperationResult { @ElementList(name = "fileList", required = false, entry = "fileVersion") private ArrayList<FileVersion> fileList; @ElementMap(name = "fileVersions", required = false, key = "fileHistoryId", value = "partialFileHistory") private HashMap<FileHistoryId, PartialFileHistory> fileVersions; public LsOperationResult() { // Nothing } public LsOperationResult(List<FileVersion> fileList, Map<FileHistoryId, PartialFileHistory> fileVersions) { this.fileList = (fileList != null) ? new ArrayList<>(fileList) : null; this.fileVersions = (fileVersions != null) ? new HashMap<>(fileVersions) : null; } public List<FileVersion> getFileList() { return fileList; } public Map<FileHistoryId, PartialFileHistory> getFileVersions() { return fileVersions; } }
/** * Constructor for the <code>Entry</code> object. This takes the * element map annotation that provides configuration as to how * the map is serialized and deserialized from the XML document. * The entry object provides a convenient means to access the XML * schema configuration using defaults where necessary. * * @param contact this is the point of contact to the map object * @param label the annotation the map method or field uses */ public Entry(Contact contact, ElementMap label) { this.attribute = label.attribute(); this.entry = label.entry(); this.value = label.value(); this.key = label.key(); this.contact = contact; this.label = label; }
/** * Constructor for the <code>ElementMapLabel</code> object. This * creates a label object, which can be used to convert an XML * node to a <code>Map</code> of XML serializable objects. * * @param contact this is the contact that this label represents * @param label the annotation that contains the schema details * @param format this is the format used to style this label */ public ElementMapLabel(Contact contact, ElementMap label, Format format) { this.detail = new Introspector(contact, this, format); this.decorator = new Qualifier(contact); this.entry = new Entry(contact, label); this.required = label.required(); this.type = contact.getType(); this.inline = label.inline(); this.override = label.name(); this.data = label.data(); this.format = format; this.label = label; }
/** * This method returns a <code>Converter</code> which can be used to * convert an XML node into an object value and vice versa. The * converter requires only the context object in order to perform * serialization or deserialization of the provided XML node. * * @param context this is the context object for the serialization * * @return this returns an object that is used for conversion */ public Converter getConverter(Context context) throws Exception { Type type = getMap(); if(!label.inline()) { return new CompositeMap(context, entry, type); } return new CompositeInlineMap(context, entry, type); }
/** * This is used to provide a configured empty value used when the * annotated value is null. This ensures that XML can be created * with required details regardless of whether values are null or * not. It also provides a means for sensible default values. * * @param context this is the context object for the serialization * * @return this returns the string to use for default values */ public Object getEmpty(Context context) throws Exception { Type map = new ClassType(type); Factory factory = new MapFactory(context, map); if(!label.empty()) { return factory.getInstance(); } return null; }
/** * Constructor for the <code>Entry</code> object. This takes the * element map annotation that provides configuration as to how * the map is serialized and deserialized from the XML document. * The entry object provides a convenient means to access the XML * schema configuration using defaults where necessary. * * @param contact this is the point of contact to the map object * @param label the annotation the map method or field uses */ public Entry(Contact contact, ElementMap label) { this.attribute = label.attribute(); this.entry = label.entry(); this.value = label.value(); this.key = label.key(); this.contact = contact; this.label = label; }
/** * Constructor for the <code>ElementMapLabel</code> object. This * creates a label object, which can be used to convert an XML * node to a <code>Map</code> of XML serializable objects. * * @param contact this is the contact that this label represents * @param label the annotation that contains the schema details * @param format this is the format used to style this label */ public ElementMapLabel(Contact contact, ElementMap label, Format format) { this.detail = new Introspector(contact, this, format); this.decorator = new Qualifier(contact); this.entry = new Entry(contact, label); this.required = label.required(); this.type = contact.getType(); this.inline = label.inline(); this.override = label.name(); this.data = label.data(); this.format = format; this.label = label; }
/** * This method returns a <code>Converter</code> which can be used to * convert an XML node into an object value and vice versa. The * converter requires only the context object in order to perform * serialization or deserialization of the provided XML node. * * @param context this is the context object for the serialization * * @return this returns an object that is used for conversion */ public Converter getConverter(Context context) throws Exception { Type type = getMap(); if(!label.inline()) { return new CompositeMap(context, entry, type); } return new CompositeInlineMap(context, entry, type); }
/** * This is used to provide a configured empty value used when the * annotated value is null. This ensures that XML can be created * with required details regardless of whether values are null or * not. It also provides a means for sensible default values. * * @param context this is the context object for the serialization * * @return this returns the string to use for default values */ public Object getEmpty(Context context) throws Exception { Type map = new ClassType(type); Factory factory = new MapFactory(context, map); if(!label.empty()) { return factory.getInstance(); } return null; }
private String type; @ElementMap(entry="property", key="name", required=false, attribute=true, inline=true) protected Map<String, String> settings;
/** * Constructor for the <code>Entry</code> object. This takes the * element map annotation that provides configuration as to how * the map is serialized and deserialized from the XML document. * The entry object provides a convenient means to access the XML * schema configuration using defaults where necessary. * * @param contact this is the point of contact to the map object * @param label the annotation the map method or field uses */ public Entry(Contact contact, ElementMap label) { this.attribute = label.attribute(); this.entry = label.entry(); this.value = label.value(); this.key = label.key(); this.contact = contact; this.label = label; }
/** * Constructor for the <code>ElementMapLabel</code> object. This * creates a label object, which can be used to convert an XML * node to a <code>Map</code> of XML serializable objects. * * @param contact this is the contact that this label represents * @param label the annotation that contains the schema details * @param format this is the format used to style this label */ public ElementMapLabel(Contact contact, ElementMap label, Format format) { this.detail = new Introspector(contact, this, format); this.decorator = new Qualifier(contact); this.entry = new Entry(contact, label); this.required = label.required(); this.type = contact.getType(); this.inline = label.inline(); this.override = label.name(); this.data = label.data(); this.format = format; this.label = label; }
/** * This method returns a <code>Converter</code> which can be used to * convert an XML node into an object value and vice versa. The * converter requires only the context object in order to perform * serialization or deserialization of the provided XML node. * * @param context this is the context object for the serialization * * @return this returns an object that is used for conversion */ public Converter getConverter(Context context) throws Exception { Type type = getMap(); if(!label.inline()) { return new CompositeMap(context, entry, type); } return new CompositeInlineMap(context, entry, type); }
/** * This is used to provide a configured empty value used when the * annotated value is null. This ensures that XML can be created * with required details regardless of whether values are null or * not. It also provides a means for sensible default values. * * @param context this is the context object for the serialization * * @return this returns the string to use for default values */ public Object getEmpty(Context context) throws Exception { Type map = new ClassType(type); Factory factory = new MapFactory(context, map); if(!label.empty()) { return factory.getInstance(); } return null; }
@ElementMap(name = "systemProperties", entry = "property", key = "name", required = false, attribute = true) private TreeMap<String, String> systemProperties;
/** * This is used to acquire the name of the element or attribute * that is used by the class schema. The name is determined by * checking for an override within the annotation. If it contains * a name then that is used, if however the annotation does not * specify a name the the field or method name is used instead. * * @return returns the name that is used for the XML property */ public String getName() throws Exception{ if(name == null) { Style style = format.getStyle(); String value = entry.getEntry(); if(!label.inline()) { value = detail.getName(); } name = style.getElement(value); } return name; }
private long minSecondsBetweenCleanups = 3 * 60 * 60; // 3 hours @ElementMap(entry = "fromTime", key = "truncateDateFormat", required = false, attribute = true, inline = true) private SortedMap<Long, TimeUnit> purgeFileVersionSettings;
/** * This is used to acquire the name of the element or attribute * that is used by the class schema. The name is determined by * checking for an override within the annotation. If it contains * a name then that is used, if however the annotation does not * specify a name the the field or method name is used instead. * * @return returns the name that is used for the XML property */ public String getName() throws Exception{ if(name == null) { Style style = format.getStyle(); String value = entry.getEntry(); if(!label.inline()) { value = detail.getName(); } name = style.getElement(value); } return name; }
public static class OffsetTransform implements AxisTransform { @ElementMap(required=false) HashMap<String, Double> offsetsByHeadMountableId = new HashMap<>(); public OffsetTransform() { offsetsByHeadMountableId.put("N1", 1.); } @Override public double toTransformed(Axis axis, HeadMountable hm, double rawCoordinate) { Double offset = offsetsByHeadMountableId.get(hm.getId()); if (offset != null) { return rawCoordinate + offset; } return rawCoordinate; } @Override public double toRaw(Axis axis, HeadMountable hm, double transformedCoordinate) { Double offset = offsetsByHeadMountableId.get(hm.getId()); if (offset != null) { return transformedCoordinate - offset; } return transformedCoordinate; } } }
/** * This is used to acquire the name of the element or attribute * that is used by the class schema. The name is determined by * checking for an override within the annotation. If it contains * a name then that is used, if however the annotation does not * specify a name the the field or method name is used instead. * * @return returns the name that is used for the XML property */ public String getName() throws Exception{ if(name == null) { Style style = format.getStyle(); String value = entry.getEntry(); if(!label.inline()) { value = detail.getName(); } name = style.getElement(value); } return name; }