public static TypeUse makeMimeTyped( TypeUse t, MimeType mt ) { if(t.getExpectedMimeType()!=null) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), t.idUse(), mt, t.getAdapterUse() ); }
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); } }
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); } }
public static TypeUse makeID( TypeUse t, ID id ) { if(t.idUse()!=ID.NONE) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), id, t.getExpectedMimeType(), t.getAdapterUse() ); }
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); } }
public static TypeUse makeID( TypeUse t, ID id ) { if(t.idUse()!=ID.NONE) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), id, t.getExpectedMimeType(), t.getAdapterUse() ); }
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); } }
public static TypeUse makeMimeTyped( TypeUse t, MimeType mt ) { if(t.getExpectedMimeType()!=null) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), t.idUse(), mt, t.getAdapterUse() ); }
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); } }
public static TypeUse makeID( TypeUse t, ID id ) { if(t.idUse()!=ID.NONE) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), id, t.getExpectedMimeType(), t.getAdapterUse() ); }
public static TypeUse makeMimeTyped( TypeUse t, MimeType mt ) { if(t.getExpectedMimeType()!=null) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), t.idUse(), mt, t.getAdapterUse() ); }
public static TypeUse makeID( TypeUse t, ID id ) { if(t.idUse()!=ID.NONE) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), id, t.getExpectedMimeType(), t.getAdapterUse() ); }
public static TypeUse makeMimeTyped( TypeUse t, MimeType mt ) { if(t.getExpectedMimeType()!=null) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), t.idUse(), mt, t.getAdapterUse() ); }
public static TypeUse makeID( TypeUse t, ID id ) { if(t.idUse()!=ID.NONE) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), id, t.getExpectedMimeType(), t.getAdapterUse() ); }
public static TypeUse makeMimeTyped( TypeUse t, MimeType mt ) { if(t.getExpectedMimeType()!=null) // I don't think we let users tweak the idness, so // this error must indicate an inconsistency within the RI/spec. throw new IllegalStateException(); return new TypeUseImpl( t.getInfo(), t.isCollection(), t.idUse(), mt, t.getAdapterUse() ); }
public static TypeUse adapt(TypeUse t, CAdapter adapter) { assert t.getAdapterUse()==null; // TODO: we don't know how to handle double adapters yet. return new TypeUseImpl(t.getInfo(),t.isCollection(),t.idUse(),t.getExpectedMimeType(),adapter); }
public static TypeUse adapt(TypeUse t, CAdapter adapter) { assert t.getAdapterUse()==null; // TODO: we don't know how to handle double adapters yet. return new TypeUseImpl(t.getInfo(),t.isCollection(),t.idUse(),t.getExpectedMimeType(),adapter); }
public static TypeUse adapt(TypeUse t, CAdapter adapter) { assert t.getAdapterUse()==null; // TODO: we don't know how to handle double adapters yet. return new TypeUseImpl(t.getInfo(),t.isCollection(),t.idUse(),t.getExpectedMimeType(),adapter); }
public static TypeUse adapt(TypeUse t, CAdapter adapter) { assert t.getAdapterUse()==null; // TODO: we don't know how to handle double adapters yet. return new TypeUseImpl(t.getInfo(),t.isCollection(),t.idUse(),t.getExpectedMimeType(),adapter); }
public static TypeUse adapt(TypeUse t, CAdapter adapter) { assert t.getAdapterUse()==null; // TODO: we don't know how to handle double adapters yet. return new TypeUseImpl(t.getInfo(),t.isCollection(),t.idUse(),t.getExpectedMimeType(),adapter); }