Tabnine Logo
DecoratedTypeMirror.isCollection
Code IndexAdd Tabnine to your IDE (free)

How to use
isCollection
method
in
net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

Best Java code snippets using net.sf.jelly.apt.decorations.type.DecoratedTypeMirror.isCollection (Showing top 20 results out of 315)

origin: org.codehaus.enunciate/enunciate-full

/**
 * Whether this REST parameter is a collection or an array.
 *
 * @return Whether this REST parameter is a collection or an array.
 */
public boolean isCollectionType() {
 DecoratedTypeMirror type = (DecoratedTypeMirror) getType();
 return type.isArray() || type.isCollection();
}
origin: org.codehaus.enunciate/enunciate-full

/**
 * The max occurs of the web result.
 *
 * @return The max occurs.
 */
public String getMaxOccurs() {
 DecoratedTypeMirror typeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(this.delegate);
 return typeMirror.isArray() || typeMirror.isCollection() ? "unbounded" : "1";
}
origin: org.codehaus.enunciate/enunciate-full

/**
 * The max occurs of this parameter as a child element.
 *
 * @return The max occurs of this parameter as a child element.
 */
public String getMaxOccurs() {
 DecoratedTypeMirror paramType = (DecoratedTypeMirror) getType();
 return paramType.isArray() || paramType.isCollection() ? "unbounded" : "1";
}
origin: org.codehaus.enunciate/enunciate-full

private boolean isDataHandlers(DecoratedTypeMirror type) {
 if (type.isCollection()) {
  Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments();
  if ((typeArgs != null) && (typeArgs.size() == 1)) {
   return isDataHandler((DecoratedTypeMirror) typeArgs.iterator().next());
  }
 }
 else if (type.isArray()) {
  return isDataHandler((DecoratedTypeMirror) ((ArrayType) type).getComponentType());
 }
 return false;
}
origin: org.codehaus.enunciate/enunciate-php

protected boolean isCollection(TypeDeclaration declaration) {
 String fqn = declaration.getQualifiedName();
 if (Collection.class.getName().equals(fqn)) {
  return true;
 }
 else if (Object.class.getName().equals(fqn)) {
  return false;
 }
 else {
  if (declaration instanceof ClassDeclaration) {
   DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration)declaration).getSuperclass());
   if (decorated.isCollection()) {
    return true;
   }
  }
  for (InterfaceType interfaceType : declaration.getSuperinterfaces()) {
   DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(interfaceType);
   if (decorated.isCollection()) {
    return true;
   }
  }
 }
 
 return false;
}
origin: org.codehaus.enunciate/enunciate-rest

private boolean isDataHandlers(DecoratedTypeMirror type) {
 if (type.isCollection()) {
  Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments();
  if ((typeArgs != null) && (typeArgs.size() == 1)) {
   return isDataHandler((DecoratedTypeMirror) typeArgs.iterator().next());
  }
 }
 else if (type.isArray()) {
  return isDataHandler((DecoratedTypeMirror) ((ArrayType) type).getComponentType());
 }
 return false;
}
origin: org.codehaus.enunciate/enunciate-full

private boolean isDataHandlers(DecoratedTypeMirror type) {
 if (type.isCollection()) {
  Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments();
  if ((typeArgs != null) && (typeArgs.size() == 1)) {
   return isDataHandler((DecoratedTypeMirror) typeArgs.iterator().next());
  }
 }
 else if (type.isArray()) {
  return isDataHandler((DecoratedTypeMirror) ((ArrayType) type).getComponentType());
 }
 return false;
}
origin: org.codehaus.enunciate/enunciate-core

@Override
public String convert(TypeMirror typeMirror) throws TemplateModelException {
 if (typeMirror instanceof ArrayType) {
  TypeMirror componentType = ((ArrayType) typeMirror).getComponentType();
  if (!(componentType instanceof PrimitiveType) || (((PrimitiveType) componentType).getKind() != PrimitiveType.Kind.BYTE)) {
   return super.convert(componentType);
  }
 }
 else if (typeMirror instanceof DeclaredType) {
  DecoratedTypeMirror decoratedTypeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
  if (decoratedTypeMirror.isCollection()) {
   DeclaredType declaredType = (DeclaredType) typeMirror;
   Iterator<TypeMirror> actualTypeArguments = declaredType.getActualTypeArguments().iterator();
   if (actualTypeArguments.hasNext()) {
    return super.convert(actualTypeArguments.next());
   }
   else {
    return Object.class.getName();
   }
  }
 }
 return super.convert(typeMirror);
}
origin: org.codehaus.enunciate/enunciate-full

@Override
public String convert(TypeMirror typeMirror) throws TemplateModelException {
 if (typeMirror instanceof ArrayType) {
  TypeMirror componentType = ((ArrayType) typeMirror).getComponentType();
  if (!(componentType instanceof PrimitiveType) || (((PrimitiveType) componentType).getKind() != PrimitiveType.Kind.BYTE)) {
   return super.convert(componentType);
  }
 }
 else if (typeMirror instanceof DeclaredType) {
  DecoratedTypeMirror decoratedTypeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
  if (decoratedTypeMirror.isCollection()) {
   DeclaredType declaredType = (DeclaredType) typeMirror;
   Iterator<TypeMirror> actualTypeArguments = declaredType.getActualTypeArguments().iterator();
   if (actualTypeArguments.hasNext()) {
    return super.convert(actualTypeArguments.next());
   }
   else {
    return Object.class.getName();
   }
  }
 }
 return super.convert(typeMirror);
}
origin: org.codehaus.enunciate/enunciate-core

@Override
public String convert(TypeMirror typeMirror) throws TemplateModelException {
 DecoratedTypeMirror decoratedMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
 if (decoratedMirror.isCollection()) {
  return convert(((DeclaredType) decoratedMirror).getDeclaration().getQualifiedName());
 }
 else {
  throw new TemplateModelException(typeMirror + " isn't a collection!");
 }
}
origin: org.codehaus.enunciate/enunciate-full

@Override
public String convert(TypeMirror typeMirror) throws TemplateModelException {
 DecoratedTypeMirror decoratedMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
 if (decoratedMirror.isCollection()) {
  return convert(((DeclaredType) decoratedMirror).getDeclaration().getQualifiedName());
 }
 else {
  throw new TemplateModelException(typeMirror + " isn't a collection!");
 }
}
origin: org.codehaus.enunciate/enunciate-full

private FaultBeanChildElement(PropertyDeclaration property) {
 DecoratedTypeMirror propertyType = (DecoratedTypeMirror) property.getPropertyType();
 this.adaperType = AdapterUtil.findAdapterType(property.getGetter());
 int minOccurs = propertyType.isPrimitive() ? 1 : 0;
 String maxOccurs = propertyType.isArray() || propertyType.isCollection() ? "unbounded" : "1";
 this.property = property;
 this.minOccurs = minOccurs;
 this.maxOccurs = maxOccurs;
}
origin: org.codehaus.enunciate/enunciate-csharp

@Override
public String convert(TypeMirror typeMirror) throws TemplateModelException {
 DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
 if (decorated.isPrimitive()) {
  PrimitiveType.Kind kind = ((PrimitiveType) decorated).getKind();
  switch (kind) {
   case BOOLEAN:
    return "bool"; //boolean as 'bool'
   case CHAR:
    return "ushort";
   default:
    return kind.toString().toLowerCase();
  }
 }
 else if (decorated.isCollection()) {
  //collections will be converted to arrays.
  return getCollectionTypeConversion((DeclaredType) typeMirror);
 }
 return super.convert(typeMirror);
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * The max occurs of the web result.
 *
 * @return The max occurs.
 */
public String getMaxOccurs() {
 DecoratedTypeMirror typeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(this.delegate);
 boolean unbounded = typeMirror.isCollection() || typeMirror.isArray();
 if (typeMirror.isArray()) {
  TypeMirror componentType = ((ArrayType) typeMirror).getComponentType();
  //special case for byte[]
  if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) {
   unbounded = false;
  }
 }
 return unbounded ? "unbounded" : "1";
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * The max occurs of this parameter as a child element.
 *
 * @return The max occurs of this parameter as a child element.
 */
public String getMaxOccurs() {
 DecoratedTypeMirror paramType = (DecoratedTypeMirror) getType();
 boolean unbounded = paramType.isCollection() || paramType.isArray();
 if (paramType.isArray()) {
  TypeMirror componentType = ((ArrayType) paramType).getComponentType();
  //special case for byte[]
  if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) {
   unbounded = false;
  }
 }
 return unbounded ? "unbounded" : "1";
}
origin: org.codehaus.enunciate/enunciate-core

private JsonPropertyDeclaration(final PropertyDeclaration propertyDeclaration) {
 super(propertyDeclaration.getGetter(), propertyDeclaration.getSetter());
 DecoratedTypeMirror decoratedPropertyType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getPropertyType());
 isList = decoratedPropertyType.isCollection() || decoratedPropertyType.isArray();
 if (decoratedPropertyType.isCollection() && getPropertyType() instanceof DeclaredType) {
  final DeclaredType declaredType = (DeclaredType) getPropertyType();
  final Collection<TypeMirror> actualTypeArguments = declaredType.getActualTypeArguments();
  if(actualTypeArguments != null && actualTypeArguments.size() == 1) {
   targetType = TypeMirrorDecorator.decorate(actualTypeArguments.iterator().next());
  } else {
   targetType = getPropertyType();
  }
 } else if (decoratedPropertyType.isArray() && getPropertyType() instanceof ArrayType) {
  final ArrayType arrayType = (ArrayType) getPropertyType();
  targetType = TypeMirrorDecorator.decorate(arrayType.getComponentType());
 } else {
  targetType = getPropertyType();
 }
}
origin: org.codehaus.enunciate/enunciate-core

private FaultBeanChildElement(PropertyDeclaration property, WebFault webFault) {
 DecoratedTypeMirror propertyType = (DecoratedTypeMirror) property.getPropertyType();
 this.adaperType = AdapterUtil.findAdapterType(property.getGetter());
 int minOccurs = propertyType.isPrimitive() ? 1 : 0;
 boolean unbounded = propertyType.isCollection() || propertyType.isArray();
 if (propertyType.isArray()) {
  TypeMirror componentType = ((ArrayType) propertyType).getComponentType();
  //special case for byte[]
  if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) {
   unbounded = false;
  }
 }
 String maxOccurs = unbounded ? "unbounded" : "1";
 this.property = property;
 this.minOccurs = minOccurs;
 this.maxOccurs = maxOccurs;
 this.webFault = webFault;
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * Get the XML type for the specified type mirror.
 *
 * @param typeMirror The type mirror.
 * @return The xml type for the specified type mirror.
 * @throws XmlTypeException If the type is invalid or unknown as an xml type.
 */
public static XmlType getXmlType(TypeMirror typeMirror) throws XmlTypeException {
 XmlTypeVisitor visitor = new XmlTypeVisitor();
 DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
 visitor.isInCollection = decorated.isCollection();
 visitor.isInArray = decorated.isArray();
 unwrapComponentType(typeMirror).accept(visitor);
 if (visitor.getErrorMessage() != null) {
  throw new XmlTypeException(visitor.getErrorMessage());
 }
 return visitor.getXmlType();
}
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();
}
net.sf.jelly.apt.decorations.typeDecoratedTypeMirrorisCollection

Popular methods of DecoratedTypeMirror

  • isInstanceOf
  • isArray
  • isPrimitive
  • isDeclared
  • isEnum
  • isVoid
  • getDocComment
  • isClass
  • setDocComment
  • <init>
  • equals
  • getDelegate
  • equals,
  • getDelegate,
  • getDocValue

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • String (java.lang)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JOptionPane (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now