当前位置: 首页>>代码示例>>Java>>正文


Java JsonManagedReference类代码示例

本文整理汇总了Java中com.fasterxml.jackson.annotation.JsonManagedReference的典型用法代码示例。如果您正苦于以下问题:Java JsonManagedReference类的具体用法?Java JsonManagedReference怎么用?Java JsonManagedReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsonManagedReference类属于com.fasterxml.jackson.annotation包,在下文中一共展示了JsonManagedReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAttribute

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
@Override
protected void setAttribute(Object pojo, AttributeMetaData attribute, Object value) {
    super.setAttribute(pojo, attribute, value);
    JsonManagedReference managedReference = attribute.getAnnotation(JsonManagedReference.class);
    if (managedReference != null && value != null) {
        Class<?> elementType = (Class<?>) attribute.getTypeArguments()[0];
        PropertyDescriptor backReference = getManagedBackReference(elementType, managedReference.value());
        if (backReference != null) {
            Collection collection = (Collection) value;
            for (Object object : collection) {
                try {
                    PropertyUtils.setProperty(object, backReference.getName(), pojo);
                } catch (Exception e) {
                    logger.info("Failed while setting the property {} on the class {}", backReference.getName(), value.getClass());
                }
            }

        }
    }
}
 
开发者ID:minnal,项目名称:minnal,代码行数:21,代码来源:BiDirectionalCollectionResolver.java

示例2: getUserAuthorizations

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
@OneToMany(mappedBy = "authorization")
@Filters({@Filter(name = "limitByNotDeleted")})
@JsonManagedReference
public List<UserAuthorization> getUserAuthorizations() {
    if (userAuthorizations == null) {
        userAuthorizations = new LinkedList<UserAuthorization>();
    }
    return userAuthorizations;
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:10,代码来源:Authorization.java

示例3: getDescriptions

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
 * @return a map of descriptions about the taxon
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taxon", orphanRemoval = true)
@Cascade({ CascadeType.ALL })
@JsonManagedReference("descriptions-taxon")
public Set<Description> getDescriptions() {
	return descriptions;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:10,代码来源:Taxon.java

示例4: getDistribution

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
 * @return the distribution associated with this taxon
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taxon", orphanRemoval = true)
@Cascade({ CascadeType.ALL })
@JsonManagedReference("distribution-taxon")
public Set<Distribution> getDistribution() {
	return distribution;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:10,代码来源:Taxon.java

示例5: getIdentifiers

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
 * @return a list of identifiers the taxon
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taxon", orphanRemoval = true)
@Cascade({ CascadeType.ALL })
@JsonManagedReference("identifier-taxon")
public Set<Identifier> getIdentifiers() {
	return identifiers;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:10,代码来源:Taxon.java

示例6: getVernacularNames

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
 * @return a map of vernacularNames for the taxon
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taxon", orphanRemoval = true)
@Cascade({ CascadeType.ALL })
@JsonManagedReference("vernacularNames-taxon")
public Set<VernacularName> getVernacularNames() {
	return vernacularNames;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:10,代码来源:Taxon.java

示例7: getMeasurementsOrFacts

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
 * @return a set of measurements or facts about the taxon
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taxon", orphanRemoval = true)
@Cascade({ CascadeType.ALL })
@JsonManagedReference("measurementsOrFacts-taxon")
public Set<MeasurementOrFact> getMeasurementsOrFacts() {
	return measurementsOrFacts;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:10,代码来源:Taxon.java

示例8: getPrimaryProvider

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
@JsonManagedReference("encounter-provider")
@JsonView({JSONViews.JDBView.class, JSONViews.WSView.class, JSONViews.EventView.class})
public EncounterProvider getPrimaryProvider() {
    if (providers == null) return null;
    for (EncounterProvider provider : providers) {
        if (provider.getPrimary() != null && provider.getPrimary()) {
            return provider;
        }
    }
    return null;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:12,代码来源:Encounter.java

示例9: getMedications

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/** 
    * Not sure what is going on here, but jackson is not serializing this properly
    * so for now I'm constructing the objects as needed.
    * TODO: need to figure this out!! 
    **/
   @JsonManagedReference("medication-administration-meds")
   @JsonIgnore
public List<MedicationAdministrationMed> getMedications() {
   	if (this.medication == null) {
   		this.medication = new ArrayList<>();
   		List<Map<String,Object>> adminMeds = (List<Map<String, Object>>) getProperty("medication");
   		if (adminMeds != null) {
    		for (Map<String,Object> adminMed : adminMeds) {
    			this.medication.add(new MedicationAdministrationMed(adminMed));
    		}
   		}
   	}
	return this.medication;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:20,代码来源:MedicationAdministration.java

示例10: getComments

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
    * TODO: Same de-serialization issue as above
    * @return
    */
   @JsonManagedReference("medication-administration-comment")
   @JsonIgnore
public List<MedicationAdministrationComment> getComments() {
   	if (this.comment == null) {
   		this.comment = new ArrayList<>();
   		List<Map<String,Object>> comments = (List<Map<String, Object>>) getProperty("comment");
   		if (comments != null) {
    		for (Map<String,Object> c : comments) {
    			this.comment.add(new MedicationAdministrationComment(c));
    		}
   		}
   	}
	return this.comment;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:19,代码来源:MedicationAdministration.java

示例11: annotatedWithIgnore

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
/**
 * Returns a boolean indicating whether the provided field is annotated with
 * some form of ignore. This method is memoized to speed up execution time
 */
boolean annotatedWithIgnore(Field f) {
  return memoizer.ignoreAnnotations(f, () -> {
    JsonIgnore jsonIgnore = getAnnotation(f, JsonIgnore.class);
    JsonIgnoreProperties classIgnoreProperties = getAnnotation(f.getDeclaringClass(), JsonIgnoreProperties.class);
    JsonIgnoreProperties fieldIgnoreProperties = null;
    boolean backReferenced = false;

    //make sure the referring field didn't specify properties to ignore
    if(referringField != null) {
      fieldIgnoreProperties = getAnnotation(referringField, JsonIgnoreProperties.class);
    }

    //make sure the referring field didn't specify a backreference annotation
    if(getAnnotation(f, JsonBackReference.class) != null && referringField != null) {
      for(Field lastField : getDeclaredFields(referringField.getDeclaringClass())) {
        JsonManagedReference fieldManagedReference = getAnnotation(lastField, JsonManagedReference.class);
        if(fieldManagedReference != null && lastField.getType().equals(f.getDeclaringClass())) {
          backReferenced = true;
          break;
        }
      }
    }

    return (jsonIgnore != null && jsonIgnore.value()) ||
        (classIgnoreProperties != null && Arrays.asList(classIgnoreProperties.value()).contains(f.getName())) ||
        (fieldIgnoreProperties != null && Arrays.asList(fieldIgnoreProperties.value()).contains(f.getName())) ||
        backReferenced;
  });
}
 
开发者ID:monitorjbl,项目名称:json-view,代码行数:34,代码来源:JsonViewSerializer.java

示例12: getTopics

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
@OneToMany(mappedBy = "meeting", fetch = FetchType.EAGER)
@JsonManagedReference
public Set<Topic> getTopics() {
  //Set<Topic> sortedTopics = new TreeSet<Topic>(Topic.TopicVoteComparator);
  //sortedTopics.addAll(this.topics);
  //return sortedTopics;
  return this.topics;
}
 
开发者ID:wisobi,项目名称:leanbean,代码行数:9,代码来源:Meeting.java

示例13: findDeserializationName

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
public String findDeserializationName(AnnotatedField paramAnnotatedField)
{
  JsonProperty localJsonProperty = (JsonProperty)paramAnnotatedField.getAnnotation(JsonProperty.class);
  if (localJsonProperty != null)
    return localJsonProperty.value();
  if ((paramAnnotatedField.hasAnnotation(JsonDeserialize.class)) || (paramAnnotatedField.hasAnnotation(JsonView.class)) || (paramAnnotatedField.hasAnnotation(JsonBackReference.class)) || (paramAnnotatedField.hasAnnotation(JsonManagedReference.class)))
    return "";
  return null;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:10,代码来源:JacksonAnnotationIntrospector.java

示例14: findReferenceType

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
public AnnotationIntrospector.ReferenceProperty findReferenceType(AnnotatedMember paramAnnotatedMember)
{
  JsonManagedReference localJsonManagedReference = (JsonManagedReference)paramAnnotatedMember.getAnnotation(JsonManagedReference.class);
  if (localJsonManagedReference != null)
    return AnnotationIntrospector.ReferenceProperty.managed(localJsonManagedReference.value());
  JsonBackReference localJsonBackReference = (JsonBackReference)paramAnnotatedMember.getAnnotation(JsonBackReference.class);
  if (localJsonBackReference != null)
    return AnnotationIntrospector.ReferenceProperty.back(localJsonBackReference.value());
  return null;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:JacksonAnnotationIntrospector.java

示例15: setAttribute

import com.fasterxml.jackson.annotation.JsonManagedReference; //导入依赖的package包/类
@Override
protected void setAttribute(Object pojo, AttributeMetaData attribute, Object value) {
    super.setAttribute(pojo, attribute, value);
    JsonManagedReference managedReference = attribute.getAnnotation(JsonManagedReference.class);
    if (managedReference != null && value != null) {
        PropertyDescriptor backReference = getManagedBackReference(value.getClass(), managedReference.value());
        if (backReference != null) {
            try {
                PropertyUtils.setProperty(value, backReference.getName(), pojo);
            } catch (Exception e) {
                logger.info("Failed while setting the property {} on the class {}", backReference.getName(), value.getClass());
            }
        }
    }
}
 
开发者ID:minnal,项目名称:minnal,代码行数:16,代码来源:BiDirectionalObjectResolver.java


注:本文中的com.fasterxml.jackson.annotation.JsonManagedReference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。