com.sun.codemodel.internal.JStringLiteral Java Examples
The following examples show how to use
com.sun.codemodel.internal.JStringLiteral.
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 File: TypeUseImpl.java From openjdk-8 with 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 File: TypeUseImpl.java From TencentKona-8 with 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 File: TypeUseImpl.java From jdk8u60 with 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 File: TypeUseImpl.java From openjdk-8-source with 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 File: TypeUseImpl.java From openjdk-jdk8u with 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 File: TypeUseImpl.java From hottub with 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 File: TypeUseImpl.java From openjdk-jdk8u-backup with 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 File: TypeUseImpl.java From openjdk-jdk9 with 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 File: WhitespaceNormalizer.java From openjdk-jdk9 with 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 File: WhitespaceNormalizer.java From openjdk-8 with 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 File: WhitespaceNormalizer.java From openjdk-8 with 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 File: WhitespaceNormalizer.java From openjdk-8-source with 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 File: WhitespaceNormalizer.java From openjdk-8-source with 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 File: WhitespaceNormalizer.java From hottub with 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 File: WhitespaceNormalizer.java From hottub with 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 File: WhitespaceNormalizer.java From openjdk-jdk9 with 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 File: WhitespaceNormalizer.java From TencentKona-8 with 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 File: WhitespaceNormalizer.java From openjdk-jdk8u-backup with 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 File: WhitespaceNormalizer.java From openjdk-jdk8u-backup with 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 File: WhitespaceNormalizer.java From openjdk-jdk8u with 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 File: WhitespaceNormalizer.java From openjdk-jdk8u with 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 File: WhitespaceNormalizer.java From jdk8u60 with 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 File: WhitespaceNormalizer.java From jdk8u60 with 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 File: WhitespaceNormalizer.java From TencentKona-8 with 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); }