@Override public PsiNameValuePairStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) { String name = null; String value = null; List<LighterASTNode> children = tree.getChildren(node); for (LighterASTNode child : children) { if (child.getTokenType() == JavaTokenType.IDENTIFIER) { name = RecordUtil.intern(tree.getCharTable(), child); } else if (child.getTokenType() == JavaElementType.LITERAL_EXPRESSION) { value = RecordUtil.intern(tree.getCharTable(), tree.getChildren(child).get(0)); value = StringUtil.unquoteString(value); } } return new PsiNameValuePairStubImpl(parentStub, StringRef.fromString(name), StringRef.fromString(value)); }
@Override public PsiNameValuePairStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) { String name = null; String value = null; List<LighterASTNode> children = tree.getChildren(node); for (LighterASTNode child : children) { if (child.getTokenType() == JavaTokenType.IDENTIFIER) { name = RecordUtil.intern(tree.getCharTable(), child); } else if (child.getTokenType() == JavaElementType.LITERAL_EXPRESSION) { value = RecordUtil.intern(tree.getCharTable(), tree.getChildren(child).get(0)); value = StringUtil.stripQuotesAroundValue(value); } } return new PsiNameValuePairStubImpl(parentStub, StringRef.fromString(name), StringRef.fromString(value)); }
@NotNull @Override public PsiNameValuePairStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { StringRef name = dataStream.readName(); return new PsiNameValuePairStubImpl(parentStub, name, dataStream.readName()); }