當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonBackReference類代碼示例

本文整理匯總了Java中com.fasterxml.jackson.annotation.JsonBackReference的典型用法代碼示例。如果您正苦於以下問題:Java JsonBackReference類的具體用法?Java JsonBackReference怎麽用?Java JsonBackReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JsonBackReference類屬於com.fasterxml.jackson.annotation包,在下文中一共展示了JsonBackReference類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processFields

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
/**
 * Processes all fields of a class
 * 
 * @param fields
 *            array of fields
 * @param definition
 *            current definition
 * @param rootDefinition
 *            definition where the recursion started to prevent an endless
 *            loop
 * @return list of {@link Property} objects
 * @throws ParserException
 *             Error while the parsing process
 */
public List<Property> processFields(Field[] fields, Definition definition, Definition rootDefinition)
        throws ParserException {
    DataTypeFactory typeHandler = new DataTypeFactory();
    List<Property> properties = new ArrayList<>();
    for (Field field : fields) {
        if (field.getAnnotation(JsonIgnore.class) == null && field.getAnnotation(JsonBackReference.class) == null) {
            Property property = new Property();
            Class<?> typeClass = field.getType();
            Annotation[] annotations = field.getAnnotations();
            Type genericType = field.getGenericType();
            processGenerics(genericType, property, definition, rootDefinition);
            DataType typeObject = typeHandler.getDataType(typeClass.getName());
            String type = typeObject.getType();
            String name = field.getName();
            property.setName(name);
            if (type.length() > 14 && (type.substring(14).equals(definition.getClassName())
                    || type.substring(14).equals(rootDefinition.getClassName()))) {
                property.setReference(type);
            } else if (type.startsWith("#")) {
                createDefinitionBySchemaAndPackageIfNotExists(type, typeClass.getTypeName(), rootDefinition);
                property.setReference(type);
            } else {
                property.setType(type);
                property.setFormat(typeObject.getFormat());
            }
            properties.add(property);
            processAnnotations(annotations, definition, name);
        }
    }
    return properties;
}
 
開發者ID:SPIRIT-21,項目名稱:javadoc2swagger,代碼行數:46,代碼來源:DefinitionParser.java

示例2: annotatedWithIgnore

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的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

示例3: getMeeting

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@Id
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "meeting_id")
@JsonBackReference
public Meeting getMeeting() {
  return meeting;
}
 
開發者ID:wisobi,項目名稱:leanbean,代碼行數:8,代碼來源:Vote.java

示例4: findDeserializationName

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的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

示例5: findReferenceType

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的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

示例6: getManagedBackReference

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
private PropertyDescriptor getManagedBackReference(Class<?> clazz, String name) {
    List<PropertyDescriptor> descriptors = PropertyUtil.getPopertiesWithAnnotation(clazz, JsonBackReference.class);
    if (descriptors != null) {
        for (PropertyDescriptor descriptor : descriptors) {
            JsonBackReference backReference = PropertyUtil.getAnnotation(descriptor, JsonBackReference.class);
            if (backReference.value().equals(name)) {
                return descriptor;
            }
        }
    }
    return null;
}
 
開發者ID:minnal,項目名稱:minnal,代碼行數:13,代碼來源:BiDirectionalObjectResolver.java

示例7: setup

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@BeforeMethod
public void setup() {
	convertor = spy(new ExcludeAnnotationsConvertor(Lists.<Class<? extends Annotation>>newArrayList(JsonBackReference.class)));
	model = mock(Model.class);
	properties = mock(LinkedHashMap.class);
	when(model.properties()).thenReturn(properties);
}
 
開發者ID:minnal,項目名稱:minnal,代碼行數:8,代碼來源:ExcludeAnnotationsConvertorTest.java

示例8: getCustomer

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="customerNumber", nullable=false)
@JsonBackReference("order-customer")
public Customer getCustomer() {
    return this.customer;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:Order.java

示例9: getOrder

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="orderNumber", nullable=false, insertable=false, updatable=false)
@JsonBackReference("orderdetail-order")
public Order getOrder() {
    return this.order;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:OrderDetail.java

示例10: getProduct

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="productCode", nullable=false, insertable=false, updatable=false)
@JsonBackReference("order-product")
public Product getProduct() {
    return this.product;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:OrderDetail.java

示例11: getUser

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@JsonBackReference
public TUser getUser() {
    return user;
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:5,代碼來源:TArticle.java

示例12: getOntologyType

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@JsonBackReference
public OntologyType getOntologyType() {
    return ontologyType;
}
 
開發者ID:SnailFastGo,項目名稱:ontology_setting,代碼行數:5,代碼來源:Ontology.java

示例13: setOntologyType

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@JsonBackReference
public void setOntologyType(OntologyType ontologyType) {
    this.ontologyType = ontologyType;
}
 
開發者ID:SnailFastGo,項目名稱:ontology_setting,代碼行數:5,代碼來源:Ontology.java

示例14: getSourceType

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@JsonBackReference
public SourceType getSourceType() {
    return sourceType;
}
 
開發者ID:SnailFastGo,項目名稱:ontology_setting,代碼行數:5,代碼來源:Source.java

示例15: setSourceType

import com.fasterxml.jackson.annotation.JsonBackReference; //導入依賴的package包/類
@JsonBackReference
public void setSourceType(SourceType sourceType) {
    this.sourceType = sourceType;
}
 
開發者ID:SnailFastGo,項目名稱:ontology_setting,代碼行數:5,代碼來源:Source.java


注:本文中的com.fasterxml.jackson.annotation.JsonBackReference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。