本文整理汇总了Java中javax.xml.bind.annotation.XmlAttachmentRef类的典型用法代码示例。如果您正苦于以下问题:Java XmlAttachmentRef类的具体用法?Java XmlAttachmentRef怎么用?Java XmlAttachmentRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlAttachmentRef类属于javax.xml.bind.annotation包,在下文中一共展示了XmlAttachmentRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: annotate
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
public void annotate(JAnnotatable programElement) {
if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
return; // nothing
CAdapter adapterUse = typeUse.getAdapterUse();
if(adapterUse!=null) {
// ugly, ugly hack
if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
programElement.annotate(XmlAttachmentRef.class);
} else {
// [RESULT]
// @XmlJavaTypeAdapter( Foo.class )
programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
adapterUse.adapterType.toType(outline,EXPOSED));
}
}
if(typeUse.isCollection())
programElement.annotate(XmlList.class);
}
示例2: parameterAnnotation
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@WebMethod
@XmlAttachmentRef
public DataHandler parameterAnnotation(DocumentPayload payload, String test, @XmlAttachmentRef DataHandler data)
{
try
{
Object dataContent = data.getContent();
System.out.println("Got " + dataContent);
if (dataContent instanceof InputStream)
{
((InputStream)dataContent).close();
}
return new DataHandler("Server data", "text/plain");
}
catch (IOException e)
{
throw new WebServiceException(e);
}
}
示例3: parameterAnnotation
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@Override
@WebMethod
@XmlAttachmentRef
public DataHandler parameterAnnotation(@XmlAttachmentRef DataHandler data)
{
try
{
Object dataContent = data.getContent();
System.out.println("Got " + dataContent);
if (dataContent instanceof InputStream)
{
((InputStream)dataContent).close();
}
return new DataHandler("Server data", "text/plain");
}
catch (IOException e)
{
throw new WebServiceException(e);
}
}
示例4: parameterAnnotation
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@WebMethod
@XmlAttachmentRef
public DocumentPayloadWithoutRef parameterAnnotation(@XmlAttachmentRef DocumentPayloadWithoutRef payload)
{
try
{
if(null == payload) throw new WebServiceException("Payload was null");
Object dataContent = payload.getData().getContent();
System.out.println("Got " + dataContent);
if (dataContent instanceof InputStream)
{
((InputStream)dataContent).close();
}
return new DocumentPayloadWithoutRef(new DataHandler("Server data", "text/plain"));
}
catch (IOException e)
{
throw new WebServiceException(e);
}
}
示例5: getJaxbAnnoMap
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
private Map<Class, Boolean> getJaxbAnnoMap(MessagePartInfo mpi) {
Map<Class, Boolean> map = new ConcurrentHashMap<Class, Boolean>();
Annotation[] anns = getMethodParameterAnnotations(mpi);
if (anns != null) {
for (Annotation anno : anns) {
if (anno instanceof XmlList) {
map.put(XmlList.class, true);
}
if (anno instanceof XmlAttachmentRef) {
map.put(XmlAttachmentRef.class, true);
}
if (anno instanceof XmlJavaTypeAdapter) {
map.put(XmlJavaTypeAdapter.class, true);
}
if (anno instanceof XmlElementWrapper) {
map.put(XmlElementWrapper.class, true);
}
}
}
return map;
}
示例6: getJaxbAnnos
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
private List<Annotation> getJaxbAnnos(MessagePartInfo mpi) {
List<Annotation> list = new java.util.concurrent.CopyOnWriteArrayList<Annotation>();
Annotation[] anns = getMethodParameterAnnotations(mpi);
if (anns != null) {
for (Annotation anno : anns) {
if (anno.annotationType() == XmlList.class
|| anno.annotationType() == XmlAttachmentRef.class
|| anno.annotationType() == XmlJavaTypeAdapter.class
|| anno.annotationType() == XmlMimeType.class
|| anno.annotationType() == XmlElement.class
|| anno.annotationType() == XmlElementWrapper.class) {
list.add(anno);
}
}
}
return list;
}
示例7: getJaxbAnnoMap
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
private Map<Class, Boolean> getJaxbAnnoMap(MessagePartInfo mpi) {
Map<Class, Boolean> map = new ConcurrentHashMap<Class, Boolean>();
Annotation[] anns = getMethodParameterAnnotations(mpi);
if (anns != null) {
for (Annotation anno : anns) {
if (anno instanceof XmlList) {
map.put(XmlList.class, true);
}
if (anno instanceof XmlAttachmentRef) {
map.put(XmlAttachmentRef.class, true);
}
if (anno instanceof XmlJavaTypeAdapter) {
map.put(XmlJavaTypeAdapter.class, true);
}
if (anno instanceof XmlElementWrapper) {
map.put(XmlElementWrapper.class, true);
}
}
}
return map;
}
示例8: annotate
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
public void annotate(JAnnotatable programElement) {
if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
return; // nothing
CAdapter adapterUse = typeUse.getAdapterUse();
if(adapterUse!=null) {
// ugly, ugly hack
if(adapterUse.getAdapterIfKnown()== SwaRefAdapter.class) {
programElement.annotate(XmlAttachmentRef.class);
} else {
// [RESULT]
// @XmlJavaTypeAdapter( Foo.class )
programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
adapterUse.adapterType.toType(outline,EXPOSED));
}
}
if(typeUse.isCollection())
programElement.annotate(XmlList.class);
}
示例9: parameterAnnotation
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@WebMethod
@XmlAttachmentRef
public DataHandler parameterAnnotation(@XmlAttachmentRef DataHandler data)
{
try
{
Object dataContent = data.getContent();
System.out.println("Got " + dataContent);
if (dataContent instanceof InputStream)
{
((InputStream)dataContent).close();
}
return new DataHandler("Server data", "text/plain");
}
catch (IOException e)
{
throw new WebServiceException(e);
}
}
示例10: generateAdapterIfNecessary
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
/**
* Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
* Also generates other per-property annotations
* (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
*/
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
CAdapter adapter = prop.getAdapter();
if (adapter != null) {
if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
field.annotate(XmlAttachmentRef.class);
} else {
// [RESULT]
// @XmlJavaTypeAdapter( Foo.class )
XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
xjtw.value(adapter.adapterType.toType(this, EXPOSED));
}
}
switch (prop.id()) {
case ID:
field.annotate(XmlID.class);
break;
case IDREF:
field.annotate(XmlIDREF.class);
break;
}
if (prop.getExpectedMimeType() != null) {
field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
}
}
示例11: generateAdapterIfNecessary
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
/**
* Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
* Also generates other per-property annotations
* (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
*/
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
CAdapter adapter = prop.getAdapter();
if (adapter != null) {
if (adapter.getAdapterIfKnown() == SwaRefAdapter.class) {
field.annotate(XmlAttachmentRef.class);
} else {
// [RESULT]
// @XmlJavaTypeAdapter( Foo.class )
XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
xjtw.value(adapter.adapterType.toType(this, EXPOSED));
}
}
switch (prop.id()) {
case ID:
field.annotate(XmlID.class);
break;
case IDREF:
field.annotate(XmlIDREF.class);
break;
}
if (prop.getExpectedMimeType() != null) {
field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
}
}
示例12: PropertyInfoImpl
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
this.seed = spi;
this.parent = parent;
if(parent==null)
/*
Various people reported a bug where this parameter is somehow null.
In an attempt to catch the error better, let's do an explicit check here.
http://forums.java.net/jive/thread.jspa?threadID=18479
http://forums.java.net/jive/thread.jspa?messageID=165946
*/
throw new AssertionError();
MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
if(mt!=null && !kind().canHaveXmlMimeType) {
parent.builder.reportError(new IllegalAnnotationException(
Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
seed.readAnnotation(XmlMimeType.class)
));
mt = null;
}
this.expectedMimeType = mt;
this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);
T t = seed.getRawType();
// check if there's an adapter applicable to the whole property
XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
if(xjta!=null) {
isCollection = false;
adapter = new Adapter<T,C>(xjta,reader(),nav());
} else {
// check if the adapter is applicable to the individual item in the property
this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
|| nav().isArrayButNotByteArray(t);
xjta = getApplicableAdapter(getIndividualType());
if(xjta==null) {
// ugly ugly hack, but we implement swaRef as adapter
XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
if(xsa!=null) {
parent.builder.hasSwaRef = true;
adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
} else {
adapter = null;
// if this field has adapter annotation but not applicable,
// that must be an error of the user
xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
if(xjta!=null) {
T ad = reader().getClassValue(xjta,"value");
parent.builder.reportError(new IllegalAnnotationException(
Messages.UNMATCHABLE_ADAPTER.format(
nav().getTypeName(ad), nav().getTypeName(t)),
xjta
));
}
}
} else {
adapter = new Adapter<T,C>(xjta,reader(),nav());
}
}
this.id = calcId();
this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
getIndividualType(),this);
}
示例13: parameterAnnotation
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@WebMethod
@XmlAttachmentRef
DataHandler parameterAnnotation(DocumentPayload payload, String test, @XmlAttachmentRef DataHandler data);
示例14: parameterAnnotation
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@WebMethod
@XmlAttachmentRef
DataHandler parameterAnnotation(@XmlAttachmentRef DataHandler data) ;
示例15: getData
import javax.xml.bind.annotation.XmlAttachmentRef; //导入依赖的package包/类
@XmlElement
@XmlAttachmentRef
public DataHandler getData()
{
return data;
}