/** * PUBLIC: * Configure the mapping to use an instance of the specified container class * to hold the target objects. The key used to index a value in the * <code>Map</code> is the value returned by a call to the specified * zero-argument method. * The method must be implemented by the class (or a superclass) of any * value to be inserted into the <code>Map</code>. * <p>The container class must implement (directly or indirectly) the * <code>java.util.Map</code> interface. * <p>To facilitate resolving the method, the mapping's referenceClass * must set before calling this method. */ public void useMapClass(Class concreteClass, String keyName) { // the reference class has to be specified before coming here if (getReferenceClassName() == null) { throw DescriptorException.referenceClassNotSpecified(this); } ContainerPolicy policy = ContainerPolicy.buildPolicyFor(concreteClass); policy.setKeyName(keyName, getReferenceClassName()); setContainerPolicy(policy); }
/** * PUBLIC: * Configure the mapping to use an instance of the specified container class * to hold the target objects. The key used to index a value in the * <code>Map</code> is the value returned by a call to the specified * zero-argument method. * The method must be implemented by the class (or a superclass) of any * value to be inserted into the <code>Map</code>. * <p>The container class must implement (directly or indirectly) the * <code>java.util.Map</code> interface. * <p>To facilitate resolving the method, the mapping's referenceClass * must set before calling this method. */ public void useMapClass(Class concreteClass, String keyName) { // the reference class has to be specified before coming here if (getReferenceClassName() == null) { throw DescriptorException.referenceClassNotSpecified(this); } ContainerPolicy policy = ContainerPolicy.buildPolicyFor(concreteClass); policy.setKeyName(keyName, getReferenceClassName()); setContainerPolicy(policy); }
/** * PUBLIC: * Configure the mapping to use an instance of the specified container class * to hold the target objects. The key used to index a value in the * <code>Map</code> is the value returned by a call to the specified * zero-argument method. * The method must be implemented by the class (or a superclass) of any * value to be inserted into the <code>Map</code>. * <p>The container class must implement (directly or indirectly) the * <code>java.util.Map</code> interface. * <p>To facilitate resolving the method, the mapping's referenceClass * must set before calling this method. */ public void useMapClass(Class concreteClass, String keyName) { // the reference class has to be specified before coming here if (getReferenceClassName() == null) { throw DescriptorException.referenceClassNotSpecified(this); } ContainerPolicy policy = ContainerPolicy.buildPolicyFor(concreteClass); policy.setKeyName(keyName, getReferenceClassName()); setContainerPolicy(policy); }
/** * INTERNAL: * Not sure were this is used, MW? */ public void useMapClassName(String concreteClassName, String methodName) { // the reference class has to be specified before coming here if (getReferenceClassName() == null) { throw DescriptorException.referenceClassNotSpecified(this); } MapContainerPolicy policy = new MapContainerPolicy(concreteClassName); policy.setKeyName(methodName, getReferenceClass().getName()); setContainerPolicy(policy); }
/** * INTERNAL: * Not sure were this is used, MW? */ public void useMapClassName(String concreteClassName, String methodName) { // the reference class has to be specified before coming here if (getReferenceClassName() == null) { throw DescriptorException.referenceClassNotSpecified(this); } MapContainerPolicy policy = new MapContainerPolicy(concreteClassName); policy.setKeyName(methodName, getReferenceClass().getName()); setContainerPolicy(policy); }
/** * INTERNAL: * Not sure were this is used, MW? */ public void useMapClassName(String concreteClassName, String methodName) { // the reference class has to be specified before coming here if (getReferenceClassName() == null) { throw DescriptorException.referenceClassNotSpecified(this); } MapContainerPolicy policy = new MapContainerPolicy(concreteClassName); policy.setKeyName(methodName, getReferenceClass().getName()); setContainerPolicy(policy); }
/** * Create a JAXB property for given collection mapping. */ private JAXBElement<XmlElement> createCollectionProperty(DatabaseMapping mapping, ObjectFactory objectFactory) { final XmlElement xmlElement = new XmlElement(); xmlElement.setJavaAttribute(mapping.getAttributeName()); xmlElement.setType(((CollectionMapping) mapping).getReferenceClassName()); final XmlJavaTypeAdapter adapter = new XmlJavaTypeAdapter(); final String adapterName = RestCollectionAdapterClassWriter.getClassName(((CollectionMapping) mapping).getReferenceClassName()); adapter.setValue(adapterName); adapter.setType(Collection.class.getName()); xmlElement.setXmlJavaTypeAdapter(adapter); return objectFactory.createXmlElement(xmlElement); }
/** * Create a JAXB property for given collection mapping. */ private JAXBElement<XmlElement> createCollectionProperty(DatabaseMapping mapping, ObjectFactory objectFactory) { final XmlElement xmlElement = new XmlElement(); xmlElement.setJavaAttribute(mapping.getAttributeName()); xmlElement.setType(((CollectionMapping) mapping).getReferenceClassName()); final XmlJavaTypeAdapter adapter = new XmlJavaTypeAdapter(); final String adapterName = RestCollectionAdapterClassWriter.getClassName(((CollectionMapping) mapping).getReferenceClassName()); adapter.setValue(adapterName); adapter.setType(Collection.class.getName()); xmlElement.setXmlJavaTypeAdapter(adapter); return objectFactory.createXmlElement(xmlElement); }
xmlElement.setType(((CollectionMapping) mapping).getReferenceClassName()); xmlElement.setContainerType(((CollectionMapping) mapping).getContainerPolicy().getContainerClassName());
xmlElement.setType(((CollectionMapping) mapping).getReferenceClassName()); xmlElement.setContainerType(((CollectionMapping) mapping).getContainerPolicy().getContainerClassName());