/** * Determines if the specified object's title (from its * <code>toString</code> method) is empty. Will return true if either: the * specified reference is null; the object's <code>toString</code> method * returns null; or if the <code>toString</code> returns an empty string. */ public static boolean isEmpty(final Object object) { final String title = titleFor(object); return title == null || title.equals(""); }
private void appendWithSpace(final Object object) { appendSpace(); title.append(titleFor(object)); }
private void appendWithSpace(final Object object) { appendSpace(); title.append(titleFor(object)); }
/** * Determines if the specified object's title is empty (or null). * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> */ public static boolean isEmpty(final Object object) { final String title = titleFor(object); return isEmpty(title); }
/** * Concatenate the the title value (the result of calling an objects label() * method), or the specified default value if the title is equal to null or * is empty, to this TitleString object. * * @param object * the ObjectAdapter to get a title from * @param defaultValue * the default text to use when the ObjectAdapter is null * @return a reference to the called object (itself). */ public final TitleBuffer concat(final Object object, final String defaultValue) { if (isEmpty(object)) { title.append(defaultValue); } else { title.append(titleFor(object)); } return this; }
/** * Concatenate the title of the object value or the specified default value if the title is equal to null or * is empty, to this {@link org.apache.isis.applib.util.TitleBuffer}. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> * * @param object * the object to get a title from * @param defaultValue * the default text to use when the object is null/empty * * @return a reference to the called object (itself). */ public final TitleBuffer concat(final Object object, final String defaultValue) { String title = titleFor(object); if (isEmpty(title)) { this.title.append(defaultValue); } else { this.title.append(title); } return this; }
/** * Concatenate the joiner text and the title of the object to the text of * this TitleString object. If no object yet exists in the object then * defaultValue is used instead. * * @return a reference to the called object (itself). */ public final TitleBuffer concat(final String joiner, final Object object, final String defaultValue) { if (isEmpty(object)) { appendJoiner(joiner); title.append(defaultValue); } else { appendJoiner(joiner); title.append(titleFor(object)); } return this; }
/** * Append the title of the specified object to this {@link org.apache.isis.applib.util.TitleBuffer}. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> */ public TitleBuffer append(final Object object) { String title = titleFor(object); if (!isEmpty(title)) { appendWithSpace(title); } return this; }
/** * Concatenate the joiner text and the title of the object to the text of * this {@link org.apache.isis.applib.util.TitleBuffer} object. If no object yet exists in the object then * defaultValue is used instead. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> * @return a reference to the called object (itself). */ public final TitleBuffer concat(final String joiner, final Object object, final String defaultValue) { String title = titleFor(object); if (isEmpty(title)) { appendJoiner(joiner); this.title.append(defaultValue); } else { appendJoiner(joiner); this.title.append(title); } return this; }
/** * Appends the joining string and the title of the specified object. If the object is empty then nothing * will be appended. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> * * @see #isEmpty(Object) */ public TitleBuffer append(final String joiner, final Object object) { String title = titleFor(object); if (!isEmpty(title)) { appendJoiner(joiner); appendWithSpace(title); } return this; }
/** * Creates a new title object, containing the title of the specified object. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> */ public TitleBuffer(final Object object, final String defaultTitle) { this(); String title = titleFor(object); if (isEmpty(title)) { concat(defaultTitle); } else { concat(title); } }
/** * Concatenate the joiner text and the title of the object to the text of * this {@link org.apache.isis.applib.util.TitleBuffer}. If no object yet exists in the object then the * joiner text is omitted. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> * * @return a reference to the called object (itself). */ public final TitleBuffer concat(final String joiner, final Object object) { String title = titleFor(object); if (!isEmpty(title)) { appendJoiner(joiner); concat(title, ""); } return this; }
/** * Appends the title of the specified object, or the specified text if the * objects title is null or empty. Prepends a space if there is already some * text in this title object. * * <p> * Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't * honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title} * annotation. If that functionality is required, first call * {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant * string. * </p> * * @param object * the object whose title is to be appended to this title. * @param defaultValue * a textual value to be used if the object's title is null or * empty. * @return a reference to the called object (itself). */ public TitleBuffer append(final Object object, final String defaultValue) { String title = titleFor(object); if (!isEmpty(title)) { appendWithSpace(title); } else { appendWithSpace(defaultValue); } return this; }
String title = titleFor(object); if (!isEmpty(title)) { appendWithSpace(title);