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

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

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

origin: net.sf.apt-jelly/apt-jelly-core

public boolean isCollection() {
 return isInstanceOf(Collection.class.getName());
}
origin: net.sf.apt-jelly/apt-jelly-core

 @Override
 public boolean isInstanceOf(String className) {
  return super.isInstanceOf(className) || Object.class.getName().equals(className);
 }
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * Whether the parameter type is a holder.
 *
 * @return Whether the parameter type is a holder.
 */
public boolean isHolder() {
 return ((DecoratedTypeMirror) getType()).isInstanceOf(Holder.class.getName());
}
origin: org.codehaus.enunciate/enunciate-core

@Override
public boolean isInstanceOf(String className) {
 DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(this.originalType);
 return decorated.isInstanceOf(className);
}
origin: org.codehaus.enunciate/enunciate-full

/**
 * Whether the return type from this REST method is XML.
 *
 * @return Whether the return type from this REST method is XML.
 */
public boolean isCustomType() {
 return ((DecoratedTypeMirror) getReturnType()).isInstanceOf(DataHandler.class.getName());
}
origin: org.codehaus.enunciate/enunciate-full

/**
 * Whether the parameter type is a holder.
 *
 * @return Whether the parameter type is a holder.
 */
public boolean isHolder() {
 return ((DecoratedTypeMirror) getType()).isInstanceOf(Holder.class.getName());
}
origin: net.sf.apt-jelly/apt-jelly-core

 @Override
 public boolean isInstanceOf(String className) {
  if (super.isInstanceOf(className)) {
   return true;
  }

  className = className.trim();
  if (className.endsWith("]")) {
   className = className.substring(0, className.length() - 1).trim();
   if (className.endsWith("[")) {
    className = className.substring(0, className.length() - 1).trim();
    DecoratedTypeMirror componentType = (DecoratedTypeMirror) getComponentType();
    return componentType.isInstanceOf(className);
   }
  }

  return false;
 }
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * Whether the specified type is a known type.
 *
 * @param typeDef The type def.
 * @return Whether the specified type is a known type.
 */
protected boolean isKnownType(TypeDefinition typeDef) {
 return knownTypes.containsKey(typeDef.getQualifiedName())
  || JAXBElement.class.getName().equals(typeDef.getQualifiedName())
  || ((DecoratedTypeMirror) typeDef.getSuperclass()).isInstanceOf(JAXBElement.class.getName());
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * Whether the specified declaration is throwable.
 *
 * @param declaration The declaration to determine whether it is throwable.
 * @return Whether the specified declaration is throwable.
 */
protected boolean isThrowable(TypeDeclaration declaration) {
 if (!(declaration instanceof ClassDeclaration)) {
  return false;
 }
 else if (Throwable.class.getName().equals(declaration.getQualifiedName())) {
  return false;
 }
 else {
  ClassType superClass = ((ClassDeclaration) declaration).getSuperclass();
  return ((DecoratedTypeMirror) TypeMirrorDecorator.decorate(superClass)).isInstanceOf(Throwable.class.getName());
 }
}
origin: org.codehaus.enunciate/enunciate-full

/**
 * Whether the specified declaration is throwable.
 *
 * @param declaration The declaration to determine whether it is throwable.
 * @return Whether the specified declaration is throwable.
 */
protected boolean isThrowable(TypeDeclaration declaration) {
 if (!(declaration instanceof ClassDeclaration)) {
  return false;
 }
 else if (Throwable.class.getName().equals(declaration.getQualifiedName())) {
  return false;
 }
 else {
  ClassType superClass = ((ClassDeclaration) declaration).getSuperclass();
  return ((DecoratedTypeMirror) TypeMirrorDecorator.decorate(superClass)).isInstanceOf(Throwable.class.getName());
 }
}
origin: org.codehaus.enunciate/enunciate-ruby

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

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

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

/**
 * Whether the any element is a collection.
 *
 * @return Whether the any element is a collection.
 */
public boolean isCollectionType() {
 DecoratedTypeMirror accessorType;
 Declaration delegate = getDelegate();
 if (delegate instanceof FieldDeclaration) {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((FieldDeclaration) delegate).getType());
 }
 else {
  accessorType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((PropertyDeclaration) delegate).getPropertyType());
 }
 return accessorType.isInstanceOf(Collection.class.getName());
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * Determines whether the class declaration is an instance of the declared type of the given fully-qualified name.
 *
 * @param classDeclaration The class declaration.
 * @param fqn              The FQN.
 * @return Whether the class declaration is an instance of the declared type of the given fully-qualified name.
 */
protected boolean isInstanceOf(ClassDeclaration classDeclaration, String fqn) {
 AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
 Types utils = env.getTypeUtils();
 DeclaredType declaredType = utils.getDeclaredType(env.getTypeDeclaration(classDeclaration.getQualifiedName()));
 DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(declaredType);
 return decorated.isInstanceOf(fqn);
}
origin: org.codehaus.enunciate/enunciate-core

/**
 * Determines whether the class declaration is an instance of the declared type of the given fully-qualified name.
 *
 * @param classDeclaration The class declaration.
 * @param fqn              The FQN.
 * @return Whether the class declaration is an instance of the declared type of the given fully-qualified name.
 */
protected boolean isInstanceOf(ClassDeclaration classDeclaration, String fqn) {
 AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
 Types utils = env.getTypeUtils();
 DeclaredType declaredType = utils.getDeclaredType(env.getTypeDeclaration(classDeclaration.getQualifiedName()));
 DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(declaredType);
 return decorated.isInstanceOf(fqn);
}
origin: org.codehaus.enunciate/enunciate-full

/**
 * Determines whether the class declaration is an instance of the declared type of the given fully-qualified name.
 *
 * @param classDeclaration The class declaration.
 * @param fqn The FQN.
 * @return Whether the class declaration is an instance of the declared type of the given fully-qualified name.
 */
protected boolean isInstanceOf(ClassDeclaration classDeclaration, String fqn) {
 AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
 Types utils = env.getTypeUtils();
 DeclaredType declaredType = utils.getDeclaredType(env.getTypeDeclaration(classDeclaration.getQualifiedName()));
 DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(declaredType);
 return decorated.isInstanceOf(fqn);
}
origin: org.codehaus.enunciate/enunciate-core

public ValidationResult validateRootResources(List<RootResource> rootResources) {
 ValidationResult result = new ValidationResult();
 for (RootResource rootResource : rootResources) {
  for (ResourceMethod resourceMethod : rootResource.getResourceMethods(true)) {
   if (resourceMethod.getDeclaredEntityParameters().size() > 1) {
    result.addError(resourceMethod, "No more than one JAX-RS entity parameter is allowed (all other parameters must be annotated with one of the JAX-RS resource parameter annotations).");
   }
   int formParamCount = 0;
   for (ResourceParameter resourceParameter : resourceMethod.getResourceParameters()) {
    if (resourceParameter.isFormParam()) {
     formParamCount++;
    }
   }
   ResourceEntityParameter entityParam = resourceMethod.getEntityParameter();
   if (entityParam != null && (formParamCount > 0)) {
    DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(entityParam.getType());
    if (!decorated.isInstanceOf(MultivaluedMap.class.getName())) {
     result.addError(entityParam, "An entity parameter must be of type MultivaluedMap<String, String> if there is another parameter annotated with @FormParam.");
    }
   }
   //todo: warn about resource methods that are not public?
   //todo: error out with ambiguous resource methods (produce same thing at same path with same method)?
  }
 }
 return result;
}
origin: org.codehaus.enunciate/enunciate-core

 @Override
 public String convert(TypeDeclaration declaration) throws TemplateModelException {
  AdapterType adapterType = AdapterUtil.findAdapterType(declaration);
  if (adapterType != null) {
   return convert(adapterType.getAdaptingType());
  }
  if (declaration instanceof ClassDeclaration) {
   DecoratedTypeMirror superType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration) declaration).getSuperclass());
   if (superType != null && superType.isInstanceOf(JAXBElement.class.getName())) {
    //for client conversions, we're going to generalize subclasses of JAXBElement to JAXBElement
    return convert(superType);
   }
  }
  String convertedPackage = convertPackage(declaration.getPackage());
  ClientName specifiedName = isUseClientNameConversions() ? declaration.getAnnotation(ClientName.class) : null;
  String simpleName = specifiedName == null ? declaration.getSimpleName() : specifiedName.value();
  return convertedPackage + getPackageSeparator() + simpleName;
 }
}
origin: org.codehaus.enunciate/enunciate-csharp

@Override
public ValidationResult validateComplexType(ComplexTypeDefinition complexType) {
 ValidationResult result = super.validateComplexType(complexType);
 for (Attribute attribute : complexType.getAttributes()) {
  if (capitalize(attribute.getClientSimpleName()).equals(complexType.getClientSimpleName())) {
   result.addError(attribute, "C# can't handle properties/fields that are of the same name as their containing class.");
  }
 }
 if (complexType.getValue() != null) {
  if (capitalize(complexType.getValue().getClientSimpleName()).equals(complexType.getClientSimpleName())) {
   result.addError(complexType.getValue(), "C# can't handle properties/fields that are of the same name as their containing class. Either rename the property/field, or use the @org.codehaus.enunciate.ClientName annotation to rename the property/field on the client-side.");
  }
 }
 for (Element element : complexType.getElements()) {
  if (element.getAccessorType() instanceof MapType && !element.isAdapted()) {
   result.addError(element, "C# doesn't have a built-in way of serializing a Map. So you're going to have to use @XmlJavaTypeAdapter to supply " +
    "your own adapter for the Map, or disable the C# module.");
  }
  if (capitalize(element.getClientSimpleName()).equals(complexType.getClientSimpleName())) {
   result.addError(element, "C# can't handle properties/fields that are of the same name as their containing class. Either rename the property/field, or use the @org.codehaus.enunciate.ClientName annotation to rename the property/field on the client-side.");
  }
 }
 if (((DecoratedTypeMirror) complexType.getSuperclass()).isInstanceOf(Map.class.getName())) {
  result.addError(complexType, "Enunciate can't generate C# code that handles types that implement java.util.Map. I'm afraid you'll have to disable the C# module or use @XmlJavaTypeAdapter to adapt the type.");
 }
 return result;
}
net.sf.jelly.apt.decorations.typeDecoratedTypeMirrorisInstanceOf

Popular methods of DecoratedTypeMirror

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

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for WebStorm
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