类com.fasterxml.jackson.databind.annotation.JsonSerialize源码实例Demo

下面列出了怎么用com.fasterxml.jackson.databind.annotation.JsonSerialize的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: usergrid   文件: Results.java
@JsonSerialize(include = Inclusion.NON_NULL)
public String getObjectName() {
    if ( dataName != null ) {
        return dataName;
    }
    if ( entities != null ) {
        return "entities";
    }
    if ( ids != null ) {
        return "ids";
    }
    if ( entity != null ) {
        return "entity";
    }
    if ( id != null ) {
        return "id";
    }
    return null;
}
 
@JsonSerialize
private void setState(String state) { 
	switch(state) { 
	case "in progress": 
		this.state = OperationState.IN_PROGRESS;
		break;
	case "succeeded": 
		this.state = OperationState.SUCCEEDED; 
		break; 
	case "failed":
		this.state = OperationState.FAILED;
		break; 
	default:
		assert(false);
		break;
	}
}
 
源代码3 项目: usergrid   文件: Results.java
@JsonSerialize(include = Inclusion.NON_NULL)
public UUID getId() {
    if ( id != null ) {
        return id;
    }
    if ( entity != null ) {
        id = entity.getUuid();
        return id;
    }
    if ( ( ids != null ) && ( ids.size() > 0 ) ) {
        id = ids.get( 0 );
        return id;
    }
    if ( ( entities != null ) && ( entities.size() > 0 ) ) {
        entity = entities.get( 0 );
        id = entity.getUuid();
        return id;
    }
    if ( ( refs != null ) && ( refs.size() > 0 ) ) {
        EntityRef ref = refs.get( 0 );
        id = ref.getUuid();
    }
    return id;
}
 
源代码4 项目: usergrid   文件: Results.java
@JsonSerialize(include = Inclusion.NON_NULL)
public List<Entity> getEntities() {
    mergeEntitiesWithMetadata();
    if ( entities != null ) {
        return entities;
    }
    /*
     * if (connectionTypeAndEntityTypeToEntityMap != null) { entities = new
     * ArrayList<Entity>(); Map<UUID, Entity> eMap = new LinkedHashMap<UUID,
     * Entity>(); for (String ctype :
     * connectionTypeAndEntityTypeToEntityMap.keySet()) { Map<String,
     * List<Entity>> m = connectionTypeAndEntityTypeToEntityMap .get(ctype);
     * for (String etype : m.keySet()) { List<Entity> l = m.get(etype); for
     * (Entity e : l) { if (!eMap.containsKey(e.getUuid())) { entities.add(e);
     * eMap.put(e.getUuid(), e); } } } } return entities; }
     */
    if ( entity != null ) {
        entities = new ArrayList<Entity>();
        entities.add( entity );
        return entities;
    }
    return new ArrayList<Entity>();
}
 
@Override
public void propertyInclusion(JDefinedClass clazz, JsonNode schema) {
  if (moduleName == null) {
    moduleName = schema.get("$module").textValue();
  }

  if (schema.has("serializer")) {
    annotateSerde(clazz, JsonSerialize.class, schema.get("serializer").asText());
  }

  if (schema.has("deserializer")) {
    annotateSerde(clazz, JsonDeserialize.class, schema.get("deserializer").asText());
  } else {
    clazz.annotate(JsonDeserialize.class).param("using", JsonDeserializer.None.class);
  }

  super.propertyInclusion(clazz, schema);
}
 
源代码6 项目: dhis2-core   文件: Message.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty
public User getSender()
{
    return sender;
}
 
源代码7 项目: dhis2-core   文件: Interpretation.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DXF_2_0 )
public OrganisationUnit getOrganisationUnit()
{
    return organisationUnit;
}
 
源代码8 项目: dhis2-core   文件: ProgramRuleVariable.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Program getProgram()
{
    return program;
}
 
源代码9 项目: dhis2-core   文件: ProgramStageSection.java
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "dataElements", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "dataElement", namespace = DxfNamespaces.DXF_2_0 )
public List<DataElement> getDataElements()
{
    return dataElements;
}
 
源代码10 项目: dhis2-core   文件: Interpretation.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DXF_2_0 )
public Visualization getVisualization()
{
    return visualization;
}
 
源代码11 项目: dhis2-core   文件: MapView.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public OrganisationUnitGroupSet getOrganisationUnitGroupSet()
{
    return organisationUnitGroupSet;
}
 
源代码12 项目: dhis2-core   文件: TrackedEntityInstance.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public OrganisationUnit getOrganisationUnit()
{
    return organisationUnit;
}
 
源代码13 项目: dhis2-core   文件: ProgramInstance.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Program getProgram()
{
    return program;
}
 
源代码14 项目: dhis2-core   文件: Program.java
@JsonProperty( "programStages" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "programStages", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "programStage", namespace = DxfNamespaces.DXF_2_0 )
public Set<ProgramStage> getProgramStages()
{
    return programStages;
}
 
源代码15 项目: dhis2-core   文件: Recipients.java
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 )
public Set<OrganisationUnit> getOrganisationUnits()
{
    return organisationUnits;
}
 
源代码16 项目: dhis2-core   文件: User.java
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 )
public Set<OrganisationUnit> getOrganisationUnits()
{
    return organisationUnits;
}
 
源代码17 项目: lams   文件: ReferenceTypeSerializer.java
protected boolean _useStatic(SerializerProvider provider, BeanProperty property,
        JavaType referredType)
{
    // First: no serializer for `Object.class`, must be dynamic
    if (referredType.isJavaLangObject()) {
        return false;
    }
    // but if type is final, might as well fetch
    if (referredType.isFinal()) { // or should we allow annotation override? (only if requested...)
        return true;
    }
    // also: if indicated by typing, should be considered static
    if (referredType.useStaticType()) {
        return true;
    }
    // if neither, maybe explicit annotation?
    AnnotationIntrospector intr = provider.getAnnotationIntrospector();
    if ((intr != null) && (property != null)) {
        Annotated ann = property.getMember();
        if (ann != null) {
            JsonSerialize.Typing t = intr.findSerializationTyping(property.getMember());
            if (t == JsonSerialize.Typing.STATIC) {
                return true;
            }
            if (t == JsonSerialize.Typing.DYNAMIC) {
                return false;
            }
        }
    }
    // and finally, may be forced by global static typing (unlikely...)
    return provider.isEnabled(MapperFeature.USE_STATIC_TYPING);
}
 
源代码18 项目: dhis2-core   文件: ProgramStageInstance.java
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public List<TrackedEntityComment> getComments()
{
    return comments;
}
 
源代码19 项目: dhis2-core   文件: ProgramStage.java
@JsonProperty( "programStageSections" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "programStageSections", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "programStageSection", namespace = DxfNamespaces.DXF_2_0 )
public Set<ProgramStageSection> getProgramStageSections()
{
    return programStageSections;
}
 
源代码20 项目: azure-keyvault-java   文件: JsonWebKey.java
/**
 * Get the n value.
 *
 * @return the n value
 */
@JsonProperty("n")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] n() {
    return this.n;
}
 
源代码21 项目: dhis2-core   文件: Map.java
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "interpretations", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "interpretation", namespace = DxfNamespaces.DXF_2_0 )
public Set<Interpretation> getInterpretations()
{
    return interpretations;
}
 
源代码22 项目: peer-os   文件: PublicKeyContainer.java
public PublicKeyContainer( @JsonProperty( "hostId" ) final String hostId,
                           @JsonSerialize( using = ByteArraySerializer.class ) @JsonProperty( "fingerprint" )
                           final byte[] fingerprint, @JsonProperty( "key" ) final String key )
{
    this.hostId = hostId;
    this.fingerprint = fingerprint;
    this.key = key;
}
 
源代码23 项目: dhis2-core   文件: ProgramStage.java
@JsonProperty( "notificationTemplates" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JacksonXmlElementWrapper( localName = "notificationTemplates", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "notificationTemplate", namespace = DxfNamespaces.DXF_2_0 )
public Set<ProgramNotificationTemplate> getNotificationTemplates()
{
    return notificationTemplates;
}
 
源代码24 项目: dhis2-core   文件: DashboardItem.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DXF_2_0 )
public Map getMap()
{
    return map;
}
 
源代码25 项目: dhis2-core   文件: ValidationResult.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public OrganisationUnit getOrganisationUnit()
{
    return organisationUnit;
}
 
源代码26 项目: dhis2-core   文件: Interpretation.java
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JacksonXmlProperty( namespace = DXF_2_0 )
public int getLikes()
{
    return likes;
}
 
源代码27 项目: usergrid   文件: ApiResponse.java
@JsonSerialize( include = Inclusion.NON_NULL )
public String getUri() {
    return uri;
}
 
源代码28 项目: sdk-rest   文件: ClientCorporation.java
@JsonProperty("customObject12s")
@JsonSerialize(using = RestOneToManySerializer.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public OneToMany<ClientCorporationCustomObjectInstance12> getCustomObject12s() {
    return customObject12s;
}
 
源代码29 项目: james-project   文件: SetMessagesError.java
@JsonSerialize
public List<BlobId> getAttachmentsNotFound() {
    return attachmentsNotFound;
}
 
源代码30 项目: usergrid   文件: CredentialsInfo.java
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public String getCipher() {
    return cipher;
}
 
 类方法
 同包方法