/** * @param genericKey * @return * @throws KeyNotFoundException */ public TagField getFirstField(FieldKey genericKey) throws KeyNotFoundException { if (supportedKeys.contains(genericKey)) { return getFirstField(genericKey.name()); } else { throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg()); } }
public void setField(TagField field) { FieldKey genericKey = FieldKey.valueOf(field.getId()); switch (genericKey) { case ARTIST: setArtist(field.toString()); break; case ALBUM: setAlbum(field.toString()); break; case TITLE: setTitle(field.toString()); break; case GENRE: setGenre(field.toString()); break; case YEAR: setYear(field.toString()); break; case COMMENT: setComment(field.toString()); break; } }
/** * @param genericKey The field id. * @return * @throws KeyNotFoundException */ public List<TagField> getFields(FieldKey genericKey) throws KeyNotFoundException { List<TagField> list = fields.get(genericKey.name()); if (list == null) { return new ArrayList<TagField>(); } return list; }
public String getValue(FieldKey genericKey, int index) throws KeyNotFoundException { if (supportedKeys.contains(genericKey)) { return getItem(genericKey.name(), index); } else { throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg()); } }
public void setField(TagField field) { FieldKey genericKey = FieldKey.valueOf(field.getId()); if (genericKey == FieldKey.TRACK) { setTrack(field.toString()); } else { super.setField(field); } }
/** * Retrieve the first value that exists for this key id * * @param genericKey * @return */ public String getFirst(String genericKey) { FieldKey matchingKey = FieldKey.valueOf(genericKey); if (matchingKey != null) { return getFirst(matchingKey); } else { return ""; } }
public boolean hasField(String id) { try { FieldKey key = FieldKey.valueOf(id.toUpperCase()); return hasField(key); } catch (java.lang.IllegalArgumentException iae) { return false; } }
public TagField createField(FieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException { if (supportedKeys.contains(genericKey)) { return new GenericTagTextField(genericKey.name(), value); } else { throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg()); } }
public void deleteField(String id) { FieldKey key = FieldKey.valueOf(id); if (key != null) { deleteField(key); } }
public List<String> getAll(FieldKey genericKey) throws KeyNotFoundException { return super.getAll(genericKey.name()); }