/** * Sets the value for an "extra" property for this schema element. If a property already exists * with the specified name, then it will be overwritten. If the value is {@code null}, then any * existing property with the given name will be removed. * * @param elem The element where to set the extra property * @param name The name for the "extra" property. It must not be {@code null}. * @param value The value for the "extra" property. If it is {@code null}, then any existing * definition will be removed. */ public static void setExtraProperty(SchemaFileElement elem, String name, String value) { ifNull(name); if (value == null) { elem.getExtraProperties().remove(name); } else { elem.getExtraProperties().put(name, newLinkedList(value)); } }
/** * Retrieves the name of a single value property for this schema element. * * @param elem The element where to get the single value property from * @param propertyName The name of the property to get * @return The single value for this property, or <code>null</code> if it is this property is not * set. */ public static String getSingleValueProperty(SchemaFileElement elem, String propertyName) { List<String> values = elem.getExtraProperties().get(propertyName); if (values != null && !values.isEmpty()) { return values.get(0); } return null; }