/** * Creates a {@link RuntimeTypeInfoSet}. */ public RuntimeTypeInfoSet getTypeInfoSet() throws IllegalAnnotationsException { // check cache if(typeInfoSetCache!=null) { RuntimeTypeInfoSet r = typeInfoSetCache.get(); if(r!=null) return r; } final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotationReader,subclassReplacements,defaultNsUri); IllegalAnnotationsException.Builder errorHandler = new IllegalAnnotationsException.Builder(); builder.setErrorHandler(errorHandler); for( Class c : classes ) { if(c==CompositeStructure.class) // CompositeStructure doesn't have TypeInfo, so skip it. // We'll add JaxBeanInfo for this later automatically continue; builder.getTypeInfo(new Ref<Type,Class>(c)); } this.hasSwaRef |= builder.hasSwaRef; RuntimeTypeInfoSet r = builder.link(); errorHandler.check(); assert r!=null : "if no error was reported, the link must be a success"; typeInfoSetCache = new WeakReference<RuntimeTypeInfoSet>(r); return r; }
public Transducer getTransducer() { if(xducer==null) { xducer = RuntimeModelBuilder.createTransducer((RuntimeNonElementRef)this); if(xducer==null) { // this situation is checked by by the link method. // avoid repeating the same error by silently recovering xducer = RuntimeBuiltinLeafInfoImpl.STRING; } } return xducer; } }
/** * Creates a {@link Transducer} given a reference. * * Used to implement {@link RuntimeNonElementRef#getTransducer()}. * Shouldn't be called from anywhere else. * * TODO: this is not the proper place for this class to be in. */ public static Transducer createTransducer(RuntimeNonElementRef ref) { Transducer t = ref.getTarget().getTransducer(); RuntimePropertyInfo src = ref.getSource(); ID id = src.id(); if(id==ID.IDREF) return RuntimeBuiltinLeafInfoImpl.STRING; if(id==ID.ID) t = new IDTransducerImpl(t); MimeType emt = src.getExpectedMimeType(); if(emt!=null) t = new MimeTypedTransducer(t,emt); if(src.inlineBinaryData()) t = new InlineBinaryTransducer(t); if(src.getSchemaType()!=null) { if (src.getSchemaType().equals(createXSSimpleType())) { return RuntimeBuiltinLeafInfoImpl.STRING; } t = new SchemaTypeTransducer(t,src.getSchemaType()); } return t; }
/** * Creates a {@link Transducer} given a reference. * * Used to implement {@link RuntimeNonElementRef#getTransducer()}. * Shouldn't be called from anywhere else. * * TODO: this is not the proper place for this class to be in. */ public static Transducer createTransducer(RuntimeNonElementRef ref) { Transducer t = ref.getTarget().getTransducer(); RuntimePropertyInfo src = ref.getSource(); ID id = src.id(); if(id==ID.IDREF) return RuntimeBuiltinLeafInfoImpl.STRING; if(id==ID.ID) t = new IDTransducerImpl(t); MimeType emt = src.getExpectedMimeType(); if(emt!=null) t = new MimeTypedTransducer(t,emt); if(src.inlineBinaryData()) t = new InlineBinaryTransducer(t); if(src.getSchemaType()!=null) { if (src.getSchemaType().equals(createXSSimpleType())) { return RuntimeBuiltinLeafInfoImpl.STRING; } t = new SchemaTypeTransducer(t,src.getSchemaType()); } return t; }
/** * Creates a {@link RuntimeTypeInfoSet}. */ public RuntimeTypeInfoSet getTypeInfoSet() throws IllegalAnnotationsException { // check cache if(typeInfoSetCache!=null) { RuntimeTypeInfoSet r = typeInfoSetCache.get(); if(r!=null) return r; } final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotationReader,subclassReplacements,defaultNsUri); IllegalAnnotationsException.Builder errorHandler = new IllegalAnnotationsException.Builder(); builder.setErrorHandler(errorHandler); for( Class c : classes ) { if(c==CompositeStructure.class) // CompositeStructure doesn't have TypeInfo, so skip it. // We'll add JaxBeanInfo for this later automatically continue; builder.getTypeInfo(new Ref<Type,Class>(c)); } this.hasSwaRef |= builder.hasSwaRef; RuntimeTypeInfoSet r = builder.link(); errorHandler.check(); assert r!=null : "if no error was reported, the link must be a success"; typeInfoSetCache = new WeakReference<RuntimeTypeInfoSet>(r); return r; }
public Transducer getTransducer() { return RuntimeModelBuilder.createTransducer(this); } }
/** * Creates a {@link Transducer} given a reference. * * Used to implement {@link RuntimeNonElementRef#getTransducer()}. * Shouldn't be called from anywhere else. * * TODO: this is not the proper place for this class to be in. */ public static Transducer createTransducer(RuntimeNonElementRef ref) { Transducer t = ref.getTarget().getTransducer(); RuntimePropertyInfo src = ref.getSource(); ID id = src.id(); if(id==ID.IDREF) return RuntimeBuiltinLeafInfoImpl.STRING; if(id==ID.ID) t = new IDTransducerImpl(t); MimeType emt = src.getExpectedMimeType(); if(emt!=null) t = new MimeTypedTransducer(t,emt); if(src.inlineBinaryData()) t = new InlineBinaryTransducer(t); if(src.getSchemaType()!=null) { if (src.getSchemaType().equals(createXSSimpleType())) { return RuntimeBuiltinLeafInfoImpl.STRING; } t = new SchemaTypeTransducer(t,src.getSchemaType()); } return t; }
/** * Creates a new JAXB model from classes represented in * <tt>java.lang.reflect</tt>. * * @param reader used to read annotations from classes. must not be null. * @param errorHandler Receives errors found during the processing. * @return null if any error was reported during the processing. If no error * is reported, a non-null valid object. */ public static RuntimeTypeInfoSet create(JAXBContextImpl context, RuntimeAnnotationReader reader, ErrorHandler errorHandler, Class... classes) { RuntimeModelBuilder builder = new RuntimeModelBuilder(context, reader, new HashMap<Class, Class>(), null); builder.setErrorHandler(errorHandler); for (Class c : classes) builder.getTypeInfo(new Ref<Type, Class>(c)); return builder.link(); }
public Transducer getTransducer() { return RuntimeModelBuilder.createTransducer(this); }
/** * Creates a {@link Transducer} given a reference. * * Used to implement {@link RuntimeNonElementRef#getTransducer()}. * Shouldn't be called from anywhere else. * * TODO: this is not the proper place for this class to be in. */ public static Transducer createTransducer(RuntimeNonElementRef ref) { Transducer t = ref.getTarget().getTransducer(); RuntimePropertyInfo src = ref.getSource(); ID id = src.id(); if(id==ID.IDREF) return RuntimeBuiltinLeafInfoImpl.STRING; if(id==ID.ID) t = new IDTransducerImpl(t); MimeType emt = src.getExpectedMimeType(); if(emt!=null) t = new MimeTypedTransducer(t,emt); if(src.inlineBinaryData()) t = new InlineBinaryTransducer(t); if(src.getSchemaType()!=null) { if (src.getSchemaType().equals(createXSSimpleType())) { return RuntimeBuiltinLeafInfoImpl.STRING; } t = new SchemaTypeTransducer(t,src.getSchemaType()); } return t; }
/** * Creates a new JAXB model from classes represented in * <tt>java.lang.reflect</tt>. * * @param reader used to read annotations from classes. must not be null. * @param errorHandler Receives errors found during the processing. * @return null if any error was reported during the processing. If no error * is reported, a non-null valid object. */ public static RuntimeTypeInfoSet create(JAXBContextImpl context, RuntimeAnnotationReader reader, ErrorHandler errorHandler, Class... classes) { RuntimeModelBuilder builder = new RuntimeModelBuilder(context, reader, new HashMap<Class, Class>(), null); builder.setErrorHandler(errorHandler); for (Class c : classes) builder.getTypeInfo(new Ref<Type, Class>(c)); return builder.link(); }
public Transducer getTransducer() { if(xducer==null) { xducer = RuntimeModelBuilder.createTransducer((RuntimeNonElementRef)this); if(xducer==null) { // this situation is checked by by the link method. // avoid repeating the same error by silently recovering xducer = RuntimeBuiltinLeafInfoImpl.STRING; } } return xducer; } }
/** * Creates a {@link RuntimeTypeInfoSet}. */ public RuntimeTypeInfoSet getTypeInfoSet() throws IllegalAnnotationsException { // check cache if(typeInfoSetCache!=null) { RuntimeTypeInfoSet r = typeInfoSetCache.get(); if(r!=null) return r; } final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotationReader,subclassReplacements,defaultNsUri); IllegalAnnotationsException.Builder errorHandler = new IllegalAnnotationsException.Builder(); builder.setErrorHandler(errorHandler); for( Class c : classes ) { if(c==CompositeStructure.class) // CompositeStructure doesn't have TypeInfo, so skip it. // We'll add JaxBeanInfo for this later automatically continue; builder.getTypeInfo(new Ref<Type,Class>(c)); } this.hasSwaRef |= builder.hasSwaRef; RuntimeTypeInfoSet r = builder.link(); errorHandler.check(); assert r!=null : "if no error was reported, the link must be a success"; typeInfoSetCache = new WeakReference<RuntimeTypeInfoSet>(r); return r; }
public Transducer getTransducer() { return RuntimeModelBuilder.createTransducer(this); } }
/** * Creates a {@link RuntimeTypeInfoSet}. */ public RuntimeTypeInfoSet getTypeInfoSet() throws IllegalAnnotationsException { // check cache if(typeInfoSetCache!=null) { RuntimeTypeInfoSet r = typeInfoSetCache.get(); if(r!=null) return r; } final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotationReader,subclassReplacements,defaultNsUri); IllegalAnnotationsException.Builder errorHandler = new IllegalAnnotationsException.Builder(); builder.setErrorHandler(errorHandler); for( Class c : classes ) { if(c==CompositeStructure.class) // CompositeStructure doesn't have TypeInfo, so skip it. // We'll add JaxBeanInfo for this later automatically continue; builder.getTypeInfo(new Ref<Type,Class>(c)); } this.hasSwaRef |= builder.hasSwaRef; RuntimeTypeInfoSet r = builder.link(); errorHandler.check(); assert r!=null : "if no error was reported, the link must be a success"; typeInfoSetCache = new WeakReference<RuntimeTypeInfoSet>(r); return r; }
public Transducer getTransducer() { return RuntimeModelBuilder.createTransducer(this); }
/** * Gets the {@link TransducedAccessor} appropriately configured for * the given property. * * <p> * This allows the implementation to use an optimized code. */ public static <T> TransducedAccessor<T> get(JAXBContextImpl context, RuntimeNonElementRef ref) { Transducer xducer = RuntimeModelBuilder.createTransducer(ref); RuntimePropertyInfo prop = ref.getSource(); if(prop.isCollection()) { return new ListTransducedAccessorImpl(xducer,prop.getAccessor(), Lister.create(Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()), prop.id(), prop.getAdapter())); } if(prop.id()==ID.IDREF) return new IDREFTransducedAccessorImpl(prop.getAccessor()); if(xducer.useNamespace()) return new CompositeContextDependentTransducedAccessorImpl( context, xducer, prop.getAccessor() ); else return new CompositeTransducedAccessorImpl( context, xducer, prop.getAccessor() ); }
public Transducer getTransducer() { if(xducer==null) { xducer = RuntimeModelBuilder.createTransducer((RuntimeNonElementRef)this); if(xducer==null) { // this situation is checked by by the link method. // avoid repeating the same error by silently recovering xducer = RuntimeBuiltinLeafInfoImpl.STRING; } } return xducer; } }
public Transducer getTransducer() { if(xducer==null) { xducer = RuntimeModelBuilder.createTransducer((RuntimeNonElementRef)this); if(xducer==null) { // this situation is checked by by the link method. // avoid repeating the same error by silently recovering xducer = RuntimeBuiltinLeafInfoImpl.STRING; } } return xducer; } }
public Transducer getTransducer() { return RuntimeModelBuilder.createTransducer(this); }