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

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

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

Accessor.isAdapted介绍

暂无

代码示例

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

/**
 * Get the resolved accessor type for this accessor.
 *
 * @return the resolved accessor type for this accessor.
 */
public TypeMirror getResolvedAccessorType() {
 TypeMirror accessorType = getAccessorType();
 if (isAdapted()) {
  accessorType = getAdapterType().getAdaptingType(accessorType);
 }
 return accessorType;
}

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

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (!accessor.isXmlList() && !accessor.isAdapted() && accessor.getBareAccessorType() instanceof InterfaceType) {
  if (accessor.isCollectionType()) {
   return "java.util.List<Object>";
  }
  else {
   return "Object";
  }
 }
 return super.convert(accessor);
}

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

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isAdapted()) {
  //if the type is adapted, the adapting type is already unwrapped.
  return convert(accessor.getAdapterType().getAdaptingType());
 }
 else {
  return convert(accessor.getAccessorType());
 }
}

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

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 TypeMirror accessorType = accessor.getAccessorType();
 if (accessor.isAdapted()) {
  accessorType = accessor.getAdapterType().getAdaptingType(accessor.getAccessorType());
 }
 return convert(accessorType);
}

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

@Override
public String convert(Accessor accessor) throws TemplateModelException {
 if (accessor.isAdapted()) {
  //if the type is adapted, the adapting type might be already unwrapped.
  return convert(accessor.getAdapterType().getAdaptingType(accessor.getAccessorType()));
 }
 else {
  return convert(accessor.getAccessorType());
 }
}

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

/**
 * If this is a collection type, return the type parameter of the collection, or null if this isn't a
 * parameterized collection type.
 *
 * @return the type parameter of the collection.
 */
public TypeMirror getCollectionItemType() {
 DecoratedTypeMirror accessorType;
 if (isAdapted()) {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getAdapterType().getAdaptingType(getAccessorType()));
 }
 else {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getAccessorType());
 }
 if (accessorType.isArray()) {
  return ((ArrayType) accessorType).getComponentType();
 }
 else if (accessorType.isCollection()) {
  Iterator<TypeMirror> itemTypes = ((DeclaredType) accessorType).getActualTypeArguments().iterator();
  if (!itemTypes.hasNext()) {
   AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
   Types typeUtils = env.getTypeUtils();
   return TypeMirrorDecorator.decorate(typeUtils.getDeclaredType(env.getTypeDeclaration(java.lang.Object.class.getName())));
  }
  else {
   return itemTypes.next();
  }
 }
 return null;
}

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

/**
 * Converts the type of an accessor.
 *
 * @param accessor The accessor.
 * @return The accessor.
 */
public String convert(Accessor accessor) throws TemplateModelException {
 TypeMirror accessorType = accessor.getAccessorType();
 if (accessor.isAdapted()) {
  boolean isArray = accessorType instanceof ArrayType;
  accessorType = accessor.getAdapterType().getAdaptingType();
  if (isArray) {
   //the adapting type will adapt the component, so we need to convert it back to an array type.
   AnnotationProcessorEnvironment ape = Context.getCurrentEnvironment();
   accessorType = ape.getTypeUtils().getArrayType(accessorType);
  }
 }
 return convert(accessorType);
}

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

/**
 * Whether the accessor type is a collection type.
 *
 * @return Whether the accessor type is a collection type.
 */
public boolean isCollectionType() {
 if (isXmlList()) {
  return false;
 }
 DecoratedTypeMirror accessorType;
 if (isAdapted()) {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getAdapterType().getAdaptingType());
 }
 else {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getAccessorType());
 }
 if (accessorType.isArray()) {
  TypeMirror componentType = ((ArrayType) accessorType).getComponentType();
  //special case for byte[]
  return !(componentType instanceof PrimitiveType) || !(((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE);
 }
 return accessorType.isCollection();
}

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

/**
 * Whether the accessor type is a collection type.
 *
 * @return Whether the accessor type is a collection type.
 */
public boolean isCollectionType() {
 if (isXmlList()) {
  return false;
 }
 DecoratedTypeMirror accessorType;
 if (isAdapted()) {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getAdapterType().getAdaptingType(getAccessorType()));
 }
 else {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getAccessorType());
 }
 if (accessorType.isArray()) {
  TypeMirror componentType = ((ArrayType) accessorType).getComponentType();
  //special case for byte[]
  return !(componentType instanceof PrimitiveType) || !(((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE);
 }
 return accessorType.isCollection();
}

相关文章