@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } Accept other = (Accept) obj; return eq(getValue(), other.getValue()); }
/** * Constructs a new instance with the given value. * * @param value value. */ public Accept(String value) { this(); setValue(value); }
/** * Returns the accept elements. * * @return accept elements */ public List<Accept> getAccepts() { List<Accept> accepts = super.getElements(Accept.KEY); if (coreVersion.isCompatible(Versions.V1)) { // Check for any accepts with a comma, in which case we split those into // multiple accept elements before returning. List<Accept> result = Lists.newArrayList(); for (Accept accept : accepts) { String acceptValue = accept.getValue(); if (acceptValue != null && acceptValue.indexOf(',') != -1) { String[] split = acceptValue.split(","); for (String part : split) { result.add(new Accept(part)); } } else { result.add(accept); } } accepts = result; } return accepts; }
/** * Adds a new accept string. * * @param accept accept string */ public Collection addAccept(String accept) { super.addElement(Accept.KEY, new Accept(accept)); return this; }
/** * Returns the accept elements. * * @return accept elements */ public List<Accept> getAccepts() { List<Accept> accepts = super.getElements(Accept.KEY); if (coreVersion.isCompatible(Versions.V1)) { // Check for any accepts with a comma, in which case we split those into // multiple accept elements before returning. List<Accept> result = Lists.newArrayList(); for (Accept accept : accepts) { String acceptValue = accept.getValue(); if (acceptValue != null && acceptValue.indexOf(',') != -1) { String[] split = acceptValue.split(","); for (String part : split) { result.add(new Accept(part)); } } else { result.add(accept); } } accepts = result; } return accepts; }
/** * Adds a new accept string. * * @param accept accept string */ public Collection addAccept(String accept) { super.addElement(Accept.KEY, new Accept(accept)); return this; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } Accept other = (Accept) obj; return eq(getValue(), other.getValue()); }
/** * Returns the accept elements. * * @return accept elements */ public List<Accept> getAccepts() { List<Accept> accepts = super.getElements(Accept.KEY); if (coreVersion.isCompatible(Versions.V1)) { // Check for any accepts with a comma, in which case we split those into // multiple accept elements before returning. List<Accept> result = Lists.newArrayList(); for (Accept accept : accepts) { String acceptValue = accept.getValue(); if (acceptValue != null && acceptValue.indexOf(',') != -1) { String[] split = acceptValue.split(","); for (String part : split) { result.add(new Accept(part)); } } else { result.add(accept); } } accepts = result; } return accepts; }
/** * Adds a new accept string. * * @param accept accept string */ public Collection addAccept(String accept) { super.addElement(Accept.KEY, new Accept(accept)); return this; }
/** * Constructs a new instance with the given value. * * @param value value. */ public Accept(String value) { this(); setValue(value); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } Accept other = (Accept) obj; return eq(getValue(), other.getValue()); }
/** * 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; }
/** * Constructs a new instance with the given value. * * @param value value. */ public Accept(String value) { this(); setValue(value); }
/** * 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; }
/** * 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; }
/** * Removes an accept string. * * @param acceptStr the string to remove * @return true if the acceptStr was removed. */ public boolean removeAccept(String acceptStr) { boolean modified = false; for (Accept accept : getAccepts()) { if (acceptStr.equals(accept.getValue())) { super.removeElement(Accept.KEY, accept); modified = true; } } return modified; }
/** * Removes an accept string. * * @param acceptStr the string to remove * @return true if the acceptStr was removed. */ public boolean removeAccept(String acceptStr) { boolean modified = false; for (Accept accept : getAccepts()) { if (acceptStr.equals(accept.getValue())) { super.removeElement(Accept.KEY, accept); modified = true; } } return modified; }