org.codehaus.enunciate.contract.jaxb.Accessor.isXmlIDREF()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.codehaus.enunciate.contract.jaxb.Accessor.isXmlIDREF()方法的一些代码示例,展示了Accessor.isXmlIDREF()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accessor.isXmlIDREF()方法的具体详情如下:
包路径:org.codehaus.enunciate.contract.jaxb.Accessor
类名称:Accessor
方法名:isXmlIDREF

Accessor.isXmlIDREF介绍

[英]Whether this accessor is an XML IDREF.
[中]此访问器是否为XML IDREF。

代码示例

代码示例来源:origin: org.codehaus.enunciate/enunciate-ruby

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isXmlIDREF()) {
  return "String";
 }
 
 return super.convert(accessor);
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-csharp

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isXmlIDREF()) {
  return "string";//C# doesn't support strict object reference resolution via IDREF.  The best we can do is (de)serialize the ID.
 }
 return super.convert(accessor);
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-php

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isXmlIDREF()) {
  return "String";
 }
 return super.convert(accessor);
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-php

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isXmlIDREF()) {
  return "string";
 }
 return super.convert(accessor);
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-c

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isXmlIDREF()) {
  return "xmlChar";
 }
 else if (accessor.isXmlList()) {
  return "xmlChar";
 }
 
 return super.convert(accessor);
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * Returns the accessor for the XML id, or null if none was found or if this isn't an Xml IDREF accessor.
 *
 * @return The accessor, or null.
 */
public MemberDeclaration getAccessorForXmlID() {
 if (isXmlIDREF()) {
  TypeMirror accessorType = getBareAccessorType();
  if (accessorType instanceof ClassType) {
   return getXmlIDAccessor((ClassType) accessorType);
  }
 }
 return null;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * Returns the accessor for the XML id, or null if none was found or if this isn't an Xml IDREF accessor.
 *
 * @return The accessor, or null.
 */
public MemberDeclaration getAccessorForXmlID() {
 if (isXmlIDREF()) {
  TypeMirror accessorType = getBareAccessorType();
  if (accessorType instanceof ClassType) {
   return getXmlIDAccessor((ClassType) accessorType);
  }
 }
 return null;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

public ValidationResult validateAccessor(Accessor accessor) {
 ValidationResult result = new ValidationResult();
 if (accessor.getDelegate() instanceof PropertyDeclaration) {
  PropertyDeclaration property = (PropertyDeclaration) accessor.getDelegate();
  DecoratedMethodDeclaration getter = property.getGetter();
  DecoratedMethodDeclaration setter = property.getSetter();
  if ((getter != null) && (setter != null)) {
   //find all JAXB annotations that are on both the setter and the getter...
   Map<String, AnnotationMirror> getterAnnotations = getter.getAnnotations();
   Map<String, AnnotationMirror> setterAnnotations = setter.getAnnotations();
   for (String annotation : getterAnnotations.keySet()) {
    if ((annotation.startsWith(XmlElement.class.getPackage().getName())) && (setterAnnotations.containsKey(annotation))) {
     result.addError(setter.getPosition(), "'" + annotation + "' is on both the getter and setter.");
    }
   }
  }
  else {
   result.addError(accessor.getPosition(), "A property accessor needs both a setter and a getter.");
  }
 }
 if ((accessor.isXmlIDREF()) && (accessor.getAccessorForXmlID() == null)) {
  result.addError(accessor.getPosition(), "An XML IDREF must have a base type that references another type that has an XML ID.");
 }
 return result;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

if ((accessor.isXmlIDREF()) && (accessor.getAccessorForXmlID() == null)) {
 if (this.disabledRules.contains("jaxb.xmlidref.references.xmlid")) {
  result.addError(accessor, "An XML IDREF must have a base type that references another type that has an XML ID.");

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * The base xml type of the accessor. The base type is either:
 * <p/>
 * <ol>
 * <li>The xml type of the accessor type.</li>
 * <li>The xml type of the component type of the accessor type if the accessor
 * type is a collection type.</li>
 * </ol>
 *
 * @return The base type.
 */
public XmlType getBaseType() {
 //first check to see if the base type is dictated by a specific annotation.
 if (isXmlID()) {
  return KnownXmlType.ID;
 }
 if (isXmlIDREF()) {
  return KnownXmlType.IDREF;
 }
 if (isSwaRef()) {
  return KnownXmlType.SWAREF;
 }
 try {
  XmlType xmlType = XmlTypeFactory.findSpecifiedType(this);
  return (xmlType != null) ? xmlType : XmlTypeFactory.getXmlType(getAccessorType());
 }
 catch (XmlTypeException e) {
  throw new ValidationException(getPosition(), e.getMessage());
 }
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * The base xml type of the accessor. The base type is either:
 * <p/>
 * <ol>
 * <li>The xml type of the accessor type.</li>
 * <li>The xml type of the component type of the accessor type if the accessor
 * type is a collection type.</li>
 * </ol>
 *
 * @return The base type.
 */
public XmlType getBaseType() {
 //first check to see if the base type is dictated by a specific annotation.
 if (isXmlID()) {
  return KnownXmlType.ID;
 }
 if (isXmlIDREF()) {
  return KnownXmlType.IDREF;
 }
 if (isSwaRef()) {
  return KnownXmlType.SWAREF;
 }
 try {
  XmlType xmlType = XmlTypeFactory.findSpecifiedType(this);
  return (xmlType != null) ? xmlType : XmlTypeFactory.getXmlType(getAccessorType());
 }
 catch (XmlTypeException e) {
  throw new ValidationException(getPosition(), "Accessor " + getName() + " of " + getTypeDefinition().getQualifiedName() + ": " + e.getMessage());
 }
}

相关文章