Java Code Examples for com.sun.codemodel.internal.JStringLiteral
The following examples show how to use
com.sun.codemodel.internal.JStringLiteral. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: TencentKona-8 Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 2
Source Project: jdk8u60 Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 3
Source Project: openjdk-jdk8u Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 4
Source Project: openjdk-jdk8u-backup Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 5
Source Project: openjdk-jdk9 Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 6
Source Project: hottub Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 7
Source Project: openjdk-8-source Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 8
Source Project: openjdk-8 Source File: TypeUseImpl.java License: GNU General Public License v2.0 | 6 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if(isCollection()) return null; if(adapter==null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown(); // try to run the adapter now rather than later. if(cons instanceof JStringLiteral && atype!=null) { JStringLiteral scons = (JStringLiteral) cons; XmlAdapter a = ClassFactory.create(atype); try { Object value = a.unmarshal(scons.str); if(value instanceof String) { return JExpr.lit((String)value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons); }
Example 9
Source Project: TencentKona-8 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 10
Source Project: TencentKona-8 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 11
Source Project: jdk8u60 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 12
Source Project: jdk8u60 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 13
Source Project: openjdk-jdk8u Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 14
Source Project: openjdk-jdk8u Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 15
Source Project: openjdk-jdk8u-backup Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 16
Source Project: openjdk-jdk8u-backup Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 17
Source Project: openjdk-jdk9 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 18
Source Project: openjdk-jdk9 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 19
Source Project: hottub Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 20
Source Project: hottub Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 21
Source Project: openjdk-8-source Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 22
Source Project: openjdk-8-source Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }
Example 23
Source Project: openjdk-8 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.replace(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("replace").arg(literal); }
Example 24
Source Project: openjdk-8 Source File: WhitespaceNormalizer.java License: GNU General Public License v2.0 | 5 votes |
public JExpression generate( JCodeModel codeModel, JExpression literal ) { // WhitespaceProcessor.replace(<literal>); if( literal instanceof JStringLiteral ) // optimize return JExpr.lit( WhiteSpaceProcessor.collapse(((JStringLiteral)literal).str) ); else return codeModel.ref(WhiteSpaceProcessor.class) .staticInvoke("collapse").arg(literal); }