@Override public Comment comment(final int line, final int col, final String str) { Comment c = new Comment(); c.text = str; return c; }
private CommandSnippetComment getComment(Document document) { for (Object content : document.getContent()) { if (content instanceof Comment) { return new CommandSnippetTextComment(((Comment) content).getText()); } } return new EmptySnippetComment(); }
@Override public final String getCommentStringValue(Object comment) { return ((Comment)comment).getValue(); }
private void normaliseLineEndings( Document document ) { for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT ) ); i.hasNext(); ) { Comment c = (Comment) i.next(); c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) ); } for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); ) { CDATA c = (CDATA) i.next(); c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) ); } }
/** * This creates the comment with the supplied text. * * @param text <code>String</code> content of comment. */ public Comment(String text) { super(CType.Comment); setText(text); }
@Override public Comment comment(final int line, final int col, final String text) { return new Comment(text); }
/** * This will handle printing of a {@link Comment}. * * @param fstack * the FormatStack * @param basedoc * The org.w3c.dom.Document for creating DOM Nodes * @param comment * <code>Comment</code> to write. * @return The input JDOM Comment converted to a DOM Comment */ protected org.w3c.dom.Comment printComment(final FormatStack fstack, final org.w3c.dom.Document basedoc, final Comment comment) { return basedoc.createComment(comment.getText()); }
str_value = ((CDATA) value).getValue(); } else if(value instanceof Comment) { str_value = ((Comment) value).getValue(); } else { str_value = value.toString();
static void logMessage(String message, Element parent) { logMessage(message); parent.addContent(new Comment(message)); } }
/** * This will handle printing of a {@link Comment}. * * @param out * <code>XMLStreamWriter</code> to use. * @param fstack * the FormatStack * @param comment * <code>Comment</code> to write. * @throws XMLStreamException * if the destination XMLStreamWriter fails */ protected void printComment(final XMLStreamWriter out, final FormatStack fstack, final Comment comment) throws XMLStreamException { out.writeComment(comment.getText()); }
str_value = ((CDATA) value).getValue(); } else if(value instanceof Comment) { str_value = ((Comment) value).getValue(); } else { str_value = value.toString();
private Element writeDatasetScanUserDefined(String userDefName, String className, Object configObj) { Element userDefElem = new Element(userDefName, defNS); userDefElem.setAttribute("className", className); if (configObj != null) { if (configObj instanceof Element) userDefElem.addContent((Element) configObj); else userDefElem.addContent(new Comment("This class <" + className + "> not yet supported. This XML is missing configuration information (of type " + configObj.getClass().getName() + ").")); } return userDefElem; }
/** * This will create an <code>Exception</code> indicating * that the addition of the <code>{@link Comment}</code> * to the <code>{@link Document}</code> is illegal. * * @param added <code>Comment</code> that could not be added * @param reason cause of the problem */ IllegalAddException(Comment added, String reason) { super(new StringBuilder() .append("The comment \"") .append(added.getText()) .append("\" could not be added to the top level of the document: ") .append(reason) .toString()); }
private Element writeDatasetScanUserDefined(String userDefName, String className, Object configObj) { Element userDefElem = new Element(userDefName, defNS); userDefElem.setAttribute("className", className); if (configObj != null) { if (configObj instanceof Element) userDefElem.addContent((Element) configObj); else userDefElem.addContent(new Comment("This class <" + className + "> not yet supported. This XML is missing configuration information (of type " + configObj.getClass().getName() + ").")); } return userDefElem; }
/** * This will create an <code>Exception</code> indicating * that the addition of the <code>{@link Comment}</code> * to the <code>{@link Element}</code> is illegal. * * @param base <code>Element</code> that the <code>Comment</code> * couldn't be added to * @param added <code>Comment</code> that could not be added * @param reason cause of the problem */ IllegalAddException(Element base, Comment added, String reason) { super(new StringBuilder() .append("The comment \"") .append(added.getText()) .append("\" could not be added as content to \"") .append(base.getQualifiedName()) .append("\": ") .append(reason) .toString()); }
private Element writeDatasetScanUserDefined( String userDefName, String className, Object configObj ) { Element userDefElem = new Element( userDefName, defNS ); userDefElem.setAttribute( "className", className ); if ( configObj != null ) { if ( configObj instanceof Element ) userDefElem.addContent( (Element) configObj ); else userDefElem.addContent( new Comment( "This class <" + className + "> not yet supported. This XML is missing configuration information (of type " + configObj.getClass().getName() + ")." ) ); } return userDefElem; }
/** * This will handle printing of a {@link Comment}. * * @param out * <code>XMLEventConsumer</code> to use. * @param fstack * the FormatStack * @param eventfactory * The XMLEventFactory for creating XMLEvents * @param comment * <code>Comment</code> to write. * @throws XMLStreamException * if the destination XMLEventConsumer fails */ protected void printComment(final XMLEventConsumer out, final FormatStack fstack, final XMLEventFactory eventfactory, final Comment comment) throws XMLStreamException { out.add(eventfactory.createComment(comment.getText())); }
public void resetAllPasswordValues( final String comment ) { for ( final Iterator<SettingValueRecord> settingValueRecordIterator = new StoredValueIterator( false ); settingValueRecordIterator.hasNext(); ) { final SettingValueRecord settingValueRecord = settingValueRecordIterator.next(); if ( settingValueRecord.getSetting().getSyntax() == PwmSettingSyntax.PASSWORD ) { this.resetSetting( settingValueRecord.getSetting(), settingValueRecord.getProfile(), null ); if ( comment != null && !comment.isEmpty() ) { final XPathExpression xp = XPathBuilder.xpathForSetting( settingValueRecord.getSetting(), settingValueRecord.getProfile() ); final Element settingElement = ( Element ) xp.evaluateFirst( document ); if ( settingElement != null ) { settingElement.addContent( new Comment( comment ) ); } } } } final String pwdHash = this.readConfigProperty( ConfigurationProperty.PASSWORD_HASH ); if ( pwdHash != null && !pwdHash.isEmpty() ) { this.writeConfigProperty( ConfigurationProperty.PASSWORD_HASH, comment ); } }
/** * This will handle printing of a {@link Comment}. * * @param out * <code>SAXTarget</code> to use. * @param fstack * the FormatStack * @param comment * <code>Comment</code> to write. * @throws SAXException * if the destination SAXTarget fails */ protected void printComment(final SAXTarget out, final FormatStack fstack, final Comment comment) throws SAXException { if (out.getLexicalHandler() != null) { char[] c = comment.getText().toCharArray(); out.getLexicalHandler().comment(c, 0, c.length); } }