/** * Assumes the content element's contents are text and * returns them as a TextContent. * * @return A TextContent containing the value of the content tag. * * @throws IllegalStateException * If the content element is not a text type. */ public TextContent getTextContent() { Content content = getContent(); if (!(content instanceof TextContent)) { throw new IllegalStateException("Content object is not a TextContent"); } return (TextContent) getContent(); }
/** * Assumes the content element's contents are text and * returns them as a TextContent. * * @return A TextContent containing the value of the content tag. * * @throws IllegalStateException * If the content element is not a text type. */ public TextContent getTextContent() { Content content = getContent(); if (!(content instanceof TextContent)) { throw new IllegalStateException("Content object is not a TextContent"); } return (TextContent) getContent(); }
/** * Assumes the content element's contents are text and * returns them as a TextContent. * * @return A TextContent containing the value of the content tag. * * @throws IllegalStateException * If the content element is not a text type. */ public TextContent getTextContent() { Content content = getContent(); if(content == null){ content = new TextContent(new PlainTextConstruct()); } if (!(content instanceof TextContent)) { throw new IllegalStateException("Content object is not a TextContent : " + content); } return (TextContent) content; }