Hi,

On Mon, Jan 30, 2012 at 4:20 PM, Nick Burch <nick.bu...@alfresco.com> wrote:
> On Mon, 30 Jan 2012, Jukka Zitting wrote:
>> What we might also consider as an extra convenience, are Metadata methods
>> like: [...]
>
> If we're doing that sort of thing, then I'd rather we put the logic onto the
> Property for that. The Property already has a type and the closed list of
> allowed values (as Strings, from the XMPDM specification). It would seem to
> me that the logic for going to/from channel numbers would best live with the
> strings themselves, on the property, rather than outside?

I'm thinking of cases where such a convenience methods could rely on
more than just a single property. For example, a getNumberOfPages()
convenience method could look something like this (with an extra
getInt(String) helper method):

    int getNumberOfPages() {
        Integer pages = metadata.getInt(PagedText.N_PAGES);
        if (pages == null) {
            pages = metadata.getInt(MSOffice.PAGE_COUNT);
        }
        if (pages == null) {
            pages = metadata.getInt(MSOffice.SLIDE_COUNT);
        }
        if (pages != null) {
            return pages;
        } else {
            return 0;
        }
    }

BR,

Jukka Zitting

Reply via email to