@Override public String toString() { return "{Collection href=" + getAttributeValue(HREF) + "}"; } }
/** * Returns whether it has the href. * * @return whether it has the href */ public boolean hasHref() { return getHref() != null; }
@Override public Element resolve(ElementMetadata<?, ?> metadata, ValidationContext vc) { String titleAttribute = getAttributeValue(TITLE); TextContent title = getElement(Source.TITLE); if (title == null) { title = TextContent.plainText(titleAttribute); addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); setAttributeValue(TITLE, titleAttribute); List<Accept> accepts = getAccepts(); if (accepts.size() > 1) { StringBuilder sb = new StringBuilder(); removeElement(Accept.KEY); addAccept(sb.toString());
/** * Sets the href. * * @param href href or <code>null</code> to reset */ public void setHref(String href) { setAttributeValue(HREF, href); }
/** * Returns a list of accept strings. */ public List<String> getAcceptList() { List<Accept> accepts = getAccepts(); List<String> result = Lists.newArrayListWithCapacity(accepts.size()); for (Accept accept : accepts) { result.add(accept.getValue()); } return result; }
/** * Add a new collection with the given title and accept types. */ public Collection addCollection(String collectionUri, String title, String... acceptedTypes) { Collection collection = new Collection(collectionUri, TextContent.plainText(title), acceptedTypes); addCollection(collection); return collection; }
/** * Construct a collection with the given href. * * @param href href. */ public Collection(String href) { this(); setHref(href); }
@Override public Element resolve(ElementMetadata<?, ?> metadata, ValidationContext vc) { String titleAttribute = getAttributeValue(TITLE); TextContent title = getElement(Source.TITLE); if (title == null) { title = TextContent.plainText(titleAttribute); addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); setAttributeValue(TITLE, titleAttribute); List<Accept> accepts = getAccepts(); if (accepts.size() > 1) { StringBuilder sb = new StringBuilder(); removeElement(Accept.KEY); addAccept(sb.toString());
/** * Sets the href. * * @param href href or <code>null</code> to reset */ public void setHref(String href) { setAttributeValue(HREF, href); }
/** * Returns a list of accept strings. */ public List<String> getAcceptList() { List<Accept> accepts = getAccepts(); List<String> result = Lists.newArrayListWithCapacity(accepts.size()); for (Accept accept : accepts) { result.add(accept.getValue()); } return result; }
/** * Add a new collection with the given title and accept types. */ public Collection addCollection(String collectionUri, String title, String... acceptedTypes) { Collection collection = new Collection(collectionUri, TextContent.plainText(title), acceptedTypes); addCollection(collection); return collection; }
/** * Construct a collection with the given href. * * @param href href. */ public Collection(String href) { this(); setHref(href); }
@Override public Element resolve(ElementMetadata<?, ?> metadata, ValidationContext vc) { String titleAttribute = getAttributeValue(TITLE); TextContent title = getElement(Source.TITLE); if (title == null) { title = TextContent.plainText(titleAttribute); addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); setAttributeValue(TITLE, titleAttribute); List<Accept> accepts = getAccepts(); if (accepts.size() > 1) { StringBuilder sb = new StringBuilder(); removeElement(Accept.KEY); addAccept(sb.toString());
/** * Sets the href. * * @param href href or <code>null</code> to reset */ public void setHref(String href) { setAttributeValue(HREF, href); }
/** * Returns a list of accept strings. */ public List<String> getAcceptList() { List<Accept> accepts = getAccepts(); List<String> result = Lists.newArrayListWithCapacity(accepts.size()); for (Accept accept : accepts) { result.add(accept.getValue()); } return result; }
/** * Add a new collection with the given title and accept types. */ public Collection addCollection(String collectionUri, String title, String... acceptedTypes) { Collection collection = new Collection(collectionUri, TextContent.plainText(title), acceptedTypes); addCollection(collection); return collection; }
/** * Construct a collection with the given href. * * @param href href. */ public Collection(String href) { this(); setHref(href); }
/** * Returns whether it has the href. * * @return whether it has the href */ public boolean hasHref() { return getHref() != null; }