@Override public boolean isEmpty() { return this.context.getTypeDefinitions().isEmpty(); }
@Override public boolean isEmpty() { return this.context.getTypeDefinitions().isEmpty(); }
@Override public Set<Syntax> getSyntaxes(ApiRegistrationContext context) { return this.context.getTypeDefinitions().isEmpty() ? Collections.<Syntax>emptySet() : Collections.<Syntax>singleton(new SyntaxImpl(this.context, context)); }
@Override public Set<Syntax> getSyntaxes(ApiRegistrationContext context) { return this.context.getTypeDefinitions().isEmpty() ? Collections.<Syntax>emptySet() : Collections.<Syntax>singleton(new SyntaxImpl(this.context, context)); }
@Override public List<DataTypeReference> getSubtypes() { ArrayList<DataTypeReference> subtypes = new ArrayList<DataTypeReference>(); for (TypeDefinition td : this.typeDefinition.getContext().getTypeDefinitions()) { if (td instanceof ObjectTypeDefinition && !td.getQualifiedName().contentEquals(this.typeDefinition.getQualifiedName()) && ((DecoratedTypeMirror) td.asType()).isInstanceOf(this.typeDefinition)) { subtypes.add(new DataTypeReferenceImpl(JsonTypeFactory.getJsonType(td.asType(), this.typeDefinition.getContext()), registrationContext)); } } return subtypes.isEmpty() ? null : subtypes; }
@Override public List<DataTypeReference> getSubtypes() { ArrayList<DataTypeReference> subtypes = new ArrayList<DataTypeReference>(); for (TypeDefinition td : this.typeDefinition.getContext().getTypeDefinitions()) { if (td instanceof ObjectTypeDefinition && !td.getQualifiedName().contentEquals(this.typeDefinition.getQualifiedName()) && ((DecoratedTypeMirror) td.asType()).isInstanceOf(this.typeDefinition)) { subtypes.add(new DataTypeReferenceImpl(JsonTypeFactory.getJsonType(td.asType(), this.typeDefinition.getContext()), registrationContext)); } } return subtypes.isEmpty() ? null : subtypes; }
@Override public List<? extends DataType> getTypes() { Collection<TypeDefinition> typeDefinitions = this.context.getTypeDefinitions(); ArrayList<DataType> dataTypes = new ArrayList<DataType>(); FacetFilter facetFilter = this.context.getContext().getConfiguration().getFacetFilter(); for (TypeDefinition typeDefinition : typeDefinitions) { if (!facetFilter.accept(typeDefinition)) { continue; } if (typeDefinition instanceof ObjectTypeDefinition) { dataTypes.add(new ObjectDataTypeImpl((ObjectTypeDefinition) typeDefinition, registrationContext)); } else if (typeDefinition instanceof EnumTypeDefinition) { dataTypes.add(new EnumDataTypeImpl((EnumTypeDefinition) typeDefinition, registrationContext)); } } Collections.sort(dataTypes, new Comparator<DataType>() { @Override public int compare(DataType o1, DataType o2) { return o1.getLabel().compareTo(o2.getLabel()); } }); return dataTypes; } }
@Override public List<? extends DataType> getTypes() { Collection<TypeDefinition> typeDefinitions = this.context.getTypeDefinitions(); ArrayList<DataType> dataTypes = new ArrayList<DataType>(); FacetFilter facetFilter = this.context.getContext().getConfiguration().getFacetFilter(); for (TypeDefinition typeDefinition : typeDefinitions) { if (!facetFilter.accept(typeDefinition)) { continue; } if (typeDefinition instanceof ObjectTypeDefinition) { dataTypes.add(new ObjectDataTypeImpl((ObjectTypeDefinition) typeDefinition, registrationContext)); } else if (typeDefinition instanceof EnumTypeDefinition) { dataTypes.add(new EnumDataTypeImpl((EnumTypeDefinition) typeDefinition, registrationContext)); } } Collections.sort(dataTypes, new Comparator<DataType>() { @Override public int compare(DataType o1, DataType o2) { return o1.getLabel().compareTo(o2.getLabel()); } }); return dataTypes; } }
public static List<String> findConflictingAccessorNamingErrors(EnunciateJackson1Context context) { List<String> errors = (List<String>) context.getContext().getProperty(CONFLICTING_JAXB_ACCESSOR_NAMING_ERRORS_PROPERTY); if (errors == null) { errors = new ArrayList<String>(); context.getContext().setProperty(CONFLICTING_JAXB_ACCESSOR_NAMING_ERRORS_PROPERTY, errors); for (TypeDefinition typeDefinition : context.getTypeDefinitions()) { Map<String, Accessor> accessorsBySimpleName = new HashMap<String, Accessor>(); for (Accessor accessor : typeDefinition.getAllAccessors()) { String name = accessor.getClientSimpleName(); Accessor conflict = accessorsBySimpleName.get(name); if (conflict != null) { errors.add(String.format("%s: accessor \"%s\" conflicts with accessor \"%s\" of %s: both are named \"%s\".", typeDefinition.getQualifiedName(), accessor, conflict, conflict.getTypeDefinition().getQualifiedName(), name)); } else { accessorsBySimpleName.put(name, accessor); } } } } return errors; } }
public static List<String> findConflictingAccessorNamingErrors(EnunciateJackson1Context context) { List<String> errors = (List<String>) context.getContext().getProperty(CONFLICTING_JAXB_ACCESSOR_NAMING_ERRORS_PROPERTY); if (errors == null) { errors = new ArrayList<String>(); context.getContext().setProperty(CONFLICTING_JAXB_ACCESSOR_NAMING_ERRORS_PROPERTY, errors); for (TypeDefinition typeDefinition : context.getTypeDefinitions()) { Map<String, Accessor> accessorsBySimpleName = new HashMap<String, Accessor>(); for (Accessor accessor : typeDefinition.getAllAccessors()) { String name = accessor.getClientSimpleName(); Accessor conflict = accessorsBySimpleName.get(name); if (conflict != null) { errors.add(String.format("%s: accessor \"%s\" conflicts with accessor \"%s\" of %s: both are named \"%s\".", typeDefinition.getQualifiedName(), accessor, conflict, conflict.getTypeDefinition().getQualifiedName(), name)); } else { accessorsBySimpleName.put(name, accessor); } } } } return errors; } }
@Override public void call(EnunciateContext context) { if ((this.jacksonModule == null || this.jacksonModule.getJacksonContext() == null || this.jacksonModule.getJacksonContext().getTypeDefinitions().isEmpty()) && (this.jackson1Module == null || this.jackson1Module.getJacksonContext() == null || this.jackson1Module.getJacksonContext().getTypeDefinitions().isEmpty())) { info("No Jackson JSON data types: GWT JSON overlays will be generated."); return; } detectAccessorNamingErrors(); File sourceDir = generateClientSources(); packageArtifacts(sourceDir); }
protected boolean usesUnmappableElements() { boolean usesUnmappableElements = false; if (this.jacksonModule != null && this.jacksonModule.getJacksonContext() != null) { for (TypeDefinition complexType : this.jacksonModule.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: PHP requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } if (this.jackson1Module != null && this.jackson1Module.getJacksonContext() != null) { for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition complexType : this.jackson1Module.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: PHP requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } return usesUnmappableElements; }
protected boolean usesUnmappableElements() { boolean usesUnmappableElements = false; if (this.jacksonModule != null && this.jacksonModule.getJacksonContext() != null) { for (TypeDefinition complexType : this.jacksonModule.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: Ruby requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } if (this.jackson1Module != null && this.jackson1Module.getJacksonContext() != null) { for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition complexType : this.jackson1Module.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: Ruby requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } return usesUnmappableElements; }
@Override public void call(EnunciateContext context) { if ((this.jacksonModule == null || this.jacksonModule.getJacksonContext() == null || this.jacksonModule.getJacksonContext().getTypeDefinitions().isEmpty()) && (this.jackson1Module == null || this.jackson1Module.getJacksonContext() == null || this.jackson1Module.getJacksonContext().getTypeDefinitions().isEmpty())) { info("No Jackson JSON data types: Java JSON client will not be generated."); return; } detectAccessorNamingErrors(); File sourceDir = generateClientSources(); File compileDir = compileClientSources(sourceDir); packageArtifacts(sourceDir, compileDir); }
protected boolean usesUnmappableElements() { boolean usesUnmappableElements = false; if (this.jacksonModule != null && this.jacksonModule.getJacksonContext() != null) { for (TypeDefinition complexType : this.jacksonModule.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: PHP requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } if (this.jackson1Module != null && this.jackson1Module.getJacksonContext() != null) { for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition complexType : this.jackson1Module.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: PHP requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } return usesUnmappableElements; }
protected boolean usesUnmappableElements() { boolean usesUnmappableElements = false; if (this.jacksonModule != null && this.jacksonModule.getJacksonContext() != null) { for (TypeDefinition complexType : this.jacksonModule.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: Ruby requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } if (this.jackson1Module != null && this.jackson1Module.getJacksonContext() != null) { for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition complexType : this.jackson1Module.getJacksonContext().getTypeDefinitions()) { if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) { warn("%s: Ruby requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType)); usesUnmappableElements = true; } } } return usesUnmappableElements; }
@Override public void call(EnunciateContext context) { if ((this.jacksonModule == null || this.jacksonModule.getJacksonContext() == null || this.jacksonModule.getJacksonContext().getTypeDefinitions().isEmpty()) && (this.jackson1Module == null || this.jackson1Module.getJacksonContext() == null || this.jackson1Module.getJacksonContext().getTypeDefinitions().isEmpty())) { info("No Jackson JSON data types: Java JSON client will not be generated."); return; } detectAccessorNamingErrors(); File sourceDir = generateClientSources(); File compileDir = compileClientSources(sourceDir); packageArtifacts(sourceDir, compileDir); }
for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition typeDefinition : jackson1Context.getTypeDefinitions()) { if (!typeDefinition.isSimple() && facetFilter.accept(typeDefinition)) { model.put("type", typeDefinition);
for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition typeDefinition : jackson1Context.getTypeDefinitions()) { if (facetFilter.accept(typeDefinition)) { if (useServerSide(typeDefinition, matcher)) {
for (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition typeDefinition : jackson1Context.getTypeDefinitions()) { if (facetFilter.accept(typeDefinition)) { if (useServerSide(typeDefinition, matcher)) {