org.codehaus.jackson.annotate.JsonSubTypes Java Examples

The following examples show how to use org.codehaus.jackson.annotate.JsonSubTypes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebResourceImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementWrapper
@XmlElementRefs({
    @XmlElementRef(type = org.asqatasun.entity.audit.IndefiniteResultImpl.class),
    @XmlElementRef(type = org.asqatasun.entity.audit.DefiniteResultImpl.class)})
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.audit.IndefiniteResultImpl.class, name="Indefinite"),
    @JsonSubTypes.Type(value=org.asqatasun.entity.audit.DefiniteResultImpl.class, name="Definite")})
public Collection<ProcessResult> getProcessResultList() {
    return (Collection)processResultSet;
}
 
Example #2
Source File: AuditImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementRefs({
    @XmlElementRef(type = org.asqatasun.entity.subject.PageImpl.class),
    @XmlElementRef(type = org.asqatasun.entity.subject.SiteImpl.class)})
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.subject.PageImpl.class, name="Page"),
    @JsonSubTypes.Type(value=org.asqatasun.entity.subject.SiteImpl.class, name="Site")})
public WebResourceImpl getSubject() {
    return subject;
}
 
Example #3
Source File: AuditImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.parameterization.ParameterImpl.class, name="Parameter")})
public Collection<Parameter> getParameterSet() {
    if (this.parameterSet == null) {
        this.parameterSet = new HashSet<>();
    }
    return (Collection)parameterSet;
}
 
Example #4
Source File: ProcessRemarkImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementWrapper
@XmlElementRefs({
    @XmlElementRef(type = org.asqatasun.entity.audit.EvidenceElementImpl.class)})
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.audit.EvidenceElementImpl.class, name="EvidenceElement")})
public Collection<EvidenceElement> getElementList() {
    return (Collection)elementSet;
}
 
Example #5
Source File: ProcessResultImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
    @XmlElementWrapper
    @XmlElementRefs({
        @XmlElementRef(type = org.asqatasun.entity.audit.ProcessRemarkImpl.class),
        @XmlElementRef(type = org.asqatasun.entity.audit.SourceCodeRemarkImpl.class)})
    @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
    @JsonSubTypes({
        @JsonSubTypes.Type(value=org.asqatasun.entity.audit.ProcessRemarkImpl.class, name="ProcessRemark"), 
        @JsonSubTypes.Type(value=org.asqatasun.entity.audit.SourceCodeRemarkImpl.class, name="SourceCodeRemark")})
//    @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
    public Collection<ProcessRemark> getRemarkSet() {
        return (Collection)remarkSet;
    }
 
Example #6
Source File: ProcessResultImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementRef(type = org.asqatasun.entity.reference.TestImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.reference.TestImpl.class, name="Test")})
public Test getTest() {
    return test;
}
 
Example #7
Source File: EvidenceElementImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@XmlTransient
@Override
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.audit.EvidenceImpl.class, name="Evidence")})
public Evidence getEvidence() {
    return (Evidence) evidence;
}
 
Example #8
Source File: DefiniteResultImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.audit.TestSolution.class, name="TestSolution")})
public Object getValue() {
    return getDefiniteValue();
}
 
Example #9
Source File: ParameterImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementWrapper
@XmlElementRef(type = org.asqatasun.entity.parameterization.ParameterElementImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.parameterization.ParameterElementImpl.class, name="ParameterElement")})
public void setParameterElement(ParameterElement parameterElement) {
    this.parameterElement = (ParameterElementImpl)parameterElement;
}
 
Example #10
Source File: ParameterElementImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementWrapper
@XmlElementRef(type = org.asqatasun.entity.parameterization.ParameterFamilyImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.parameterization.ParameterFamilyImpl.class, name="ParameterFamily")})
public void setParameterFamily(ParameterFamily parameterFamily) {
    this.parameterFamily = (ParameterFamilyImpl)parameterFamily;
}
 
Example #11
Source File: TestImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementRef(type = org.asqatasun.entity.reference.CriterionImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.reference.CriterionImpl.class, name="Criterion")})
public Criterion getCriterion() {
    return this.criterion;
}
 
Example #12
Source File: TestImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementRef(type = org.asqatasun.entity.reference.LevelImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.reference.LevelImpl.class, name="Level")})
public Level getLevel() {
    return this.level;
}
 
Example #13
Source File: TestImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementRef(type = org.asqatasun.entity.reference.ScopeImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.reference.ScopeImpl.class, name="Scope")})
public Scope getScope() {
    return this.scope;
}
 
Example #14
Source File: CriterionImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@XmlElementRef(type = org.asqatasun.entity.reference.ThemeImpl.class)
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
    @JsonSubTypes.Type(value=org.asqatasun.entity.reference.ThemeImpl.class, name="Theme")})
public Theme getTheme() {
    return theme;
}
 
Example #15
Source File: JacksonDiscriminatorInheritanceTypeExtension.java    From raml-java-tools with Apache License 2.0 4 votes vote down vote up
@Override
public TypeSpec.Builder classCreated(ObjectPluginContext objectPluginContext, ObjectTypeDeclaration ramlType, TypeSpec.Builder typeSpec, EventType eventType) {

  if ( eventType == EventType.IMPLEMENTATION) {
    return typeSpec;
  }

  ObjectTypeDeclaration otr = ramlType;

  if (otr.discriminator() != null && objectPluginContext.childClasses(otr.name()).size() > 0) {

    typeSpec.addAnnotation(AnnotationSpec.builder(JsonTypeInfo.class)
            .addMember("use", "$T.Id.NAME", JsonTypeInfo.class)
            .addMember("include", "$T.As.EXISTING_PROPERTY", JsonTypeInfo.class)
            .addMember("property", "$S", otr.discriminator()).build());

    AnnotationSpec.Builder subTypes = AnnotationSpec.builder(JsonSubTypes.class);
    for (CreationResult result : objectPluginContext.childClasses(ramlType.name())) {

      subTypes.addMember(
              "value",
              "$L",
              AnnotationSpec
                      .builder(JsonSubTypes.Type.class)
                      .addMember("value", "$L",
                              result.getJavaName(EventType.INTERFACE) + ".class").build());
    }

    subTypes.addMember(
            "value",
            "$L",
            AnnotationSpec
                    .builder(JsonSubTypes.Type.class)
                    .addMember("value", "$L",
                            objectPluginContext.creationResult().getJavaName(EventType.INTERFACE) + ".class").build());

    typeSpec.addAnnotation(subTypes.build());

  }

  if (otr.discriminatorValue() != null) {

    typeSpec.addAnnotation(AnnotationSpec.builder(JsonTypeName.class)
            .addMember("value", "$S", otr.discriminatorValue()).build());
  }


  if (!Annotations.ABSTRACT.get(otr)) {

    typeSpec.addAnnotation(AnnotationSpec.builder(JsonDeserialize.class)
            .addMember("as", "$T.class", objectPluginContext.creationResult().getJavaName(EventType.IMPLEMENTATION))
            .build());
  }


  return typeSpec;
}