Package org.codehaus.enunciate.contract.jaxb

Examples of org.codehaus.enunciate.contract.jaxb.EnumTypeDefinition


    Object unwrapped = BeansWrapper.getDefaultInstance().unwrap((TemplateModel) list.get(0));
    if (!(unwrapped instanceof EnumTypeDefinition)) {
      throw new TemplateModelException("The nameForEnumConstant method must have an enum type definition as a parameter.");
    }
    EnumTypeDefinition typeDefinition = (EnumTypeDefinition) unwrapped;

    unwrapped = BeansWrapper.getDefaultInstance().unwrap((TemplateModel) list.get(1));
    if (!(unwrapped instanceof EnumConstantDeclaration)) {
      throw new TemplateModelException("The nameForEnumConstant method must have an enum constant declaration as a parameter.");
    }
    EnumConstantDeclaration constant = (EnumConstantDeclaration) unwrapped;

    String name = ObjCDeploymentModule.scrubIdentifier(typeDefinition.getName());
    String simpleName = ObjCDeploymentModule.scrubIdentifier(typeDefinition.getSimpleName());
    String clientName = ObjCDeploymentModule.scrubIdentifier(typeDefinition.getClientSimpleName());
    String simpleNameDecap = ObjCDeploymentModule.scrubIdentifier(Introspector.decapitalize(simpleName));
    String clientNameDecap = ObjCDeploymentModule.scrubIdentifier(Introspector.decapitalize(clientName));
    if (name == null) {
      name = "anonymous_" + clientNameDecap;
    }
    PackageDeclaration pckg = ((TypeDeclaration) typeDefinition).getPackage();
    String packageName = pckg == null ? "" : pckg.getQualifiedName();
    String packageIdentifier = this.packages2ids.containsKey(packageName) ? ObjCDeploymentModule.scrubIdentifier(this.packages2ids.get(packageName)) : ObjCDeploymentModule.scrubIdentifier(packageName);
    String nsid = ObjCDeploymentModule.scrubIdentifier(namespaces2ids.get(typeDefinition.getNamespace()));

    String constantName = ObjCDeploymentModule.scrubIdentifier(constant.getSimpleName());
    String constantClientName = ObjCDeploymentModule.scrubIdentifier(constant.getAnnotation(ClientName.class) != null ? constant.getAnnotation(ClientName.class).value() : constantName);
    return String.format(this.pattern, this.projectLabel, nsid, name, clientName, clientNameDecap, simpleName, simpleNameDecap, packageIdentifier, constantClientName, constantName);
  }
View Full Code Here


    Object unwrapped = BeansWrapper.getDefaultInstance().unwrap((TemplateModel) list.get(0));
    if (!(unwrapped instanceof EnumTypeDefinition)) {
      throw new TemplateModelException("The nameForEnumConstant method must have an enum type definition as a parameter.");
    }
    EnumTypeDefinition typeDefinition = (EnumTypeDefinition) unwrapped;

    unwrapped = BeansWrapper.getDefaultInstance().unwrap((TemplateModel) list.get(1));
    if (!(unwrapped instanceof EnumConstantDeclaration)) {
      throw new TemplateModelException("The nameForEnumConstant method must have an enum constant declaration as a parameter.");
    }
    EnumConstantDeclaration constant = (EnumConstantDeclaration) unwrapped;

    String name = CDeploymentModule.scrubIdentifier(typeDefinition.getName());
    String simpleName = CDeploymentModule.scrubIdentifier(typeDefinition.getSimpleName());
    String clientName = CDeploymentModule.scrubIdentifier(typeDefinition.getClientSimpleName());
    String simpleNameDecap = CDeploymentModule.scrubIdentifier(Introspector.decapitalize(simpleName));
    String clientNameDecap = CDeploymentModule.scrubIdentifier(Introspector.decapitalize(clientName));
    if (name == null) {
      name = "anonymous_" + clientNameDecap;
    }
    PackageDeclaration pckg = ((TypeDeclaration) typeDefinition).getPackage();
    String packageUnderscored = CDeploymentModule.scrubIdentifier(pckg != null ? pckg.getQualifiedName().replace('.', '_') :"");
    String nsid = CDeploymentModule.scrubIdentifier(namespaces2ids.get(typeDefinition.getNamespace()));

    String constantName = CDeploymentModule.scrubIdentifier(constant.getSimpleName());
    String constantClientName = CDeploymentModule.scrubIdentifier(constant.getAnnotation(ClientName.class) != null ? constant.getAnnotation(ClientName.class).value() : constantName);
    return String.format(this.pattern, this.projectLabel, nsid, name, clientName, clientNameDecap, simpleName, simpleNameDecap, packageUnderscored, constantClientName, constantName);
  }
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.contract.jaxb.EnumTypeDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.