List of usage examples for org.eclipse.jdt.core.dom StringLiteral ESCAPED_VALUE_PROPERTY
SimplePropertyDescriptor ESCAPED_VALUE_PROPERTY
To view the source code for org.eclipse.jdt.core.dom StringLiteral ESCAPED_VALUE_PROPERTY.
Click Source Link
From source file:org.moe.natjgen.EditContext.java
License:Apache License
protected Expression newStringLiteral(String name) { StringLiteral literal = getAST().newStringLiteral(); getRewrite().set(literal, StringLiteral.ESCAPED_VALUE_PROPERTY, "\"" + StringEscapeUtils.escapeJava(name) + "\"", getEditGroup()); return literal; }
From source file:org.moe.natjgen.EditContext.java
License:Apache License
protected void setSMAStringValue(Annotation annotation, String string) throws GeneratorException { editLock();/*from w ww . ja v a 2 s . c o m*/ if (annotation == null) { throw new IllegalArgumentException("'annotation' argument cannot be null!"); } if (string == null || string.length() == 0) { throw new IllegalArgumentException("'string' argument must have a valid value!"); } StringLiteral literal = removeOnTypeMismatch( getRewrite().get(annotation, SingleMemberAnnotation.VALUE_PROPERTY), StringLiteral.class); if (literal == null) { literal = getAST().newStringLiteral(); getRewrite().set(annotation, SingleMemberAnnotation.VALUE_PROPERTY, literal, getEditGroup()); } String value = literal.getLiteralValue(); if (value == null || !value.equals(string)) { value = "\"" + string + "\""; getRewrite().set(literal, StringLiteral.ESCAPED_VALUE_PROPERTY, value, getEditGroup()); } }
From source file:org.moe.natjgen.EditContext.java
License:Apache License
protected String getNAStringValue(Annotation annotation, String key) { Expression expr = getNAValue(annotation, key); if (expr instanceof StringLiteral) { String string = (String) getRewrite().get(expr, StringLiteral.ESCAPED_VALUE_PROPERTY); if (string != null && string.length() >= 2) { return StringEscapeUtils.unescapeJava(string.substring(1, string.length() - 1)); }//from ww w . ja v a 2 s . co m } return null; }
From source file:org.moe.natjgen.EditContext.java
License:Apache License
protected String getSMAStringValue(Annotation annotation) { Expression expr = getSMAValue(annotation); if (expr instanceof StringLiteral) { String string = (String) getRewrite().get(expr, StringLiteral.ESCAPED_VALUE_PROPERTY); if (string != null && string.length() >= 2) { return StringEscapeUtils.unescapeJava(string.substring(1, string.length() - 1)); }//from w w w . ja v a 2s. co m } return null; }