/** * Method for constructing dummy bean deserializer; one that * never outputs any properties */ public static BeanSerializer createDummy(Class<?> forType) { return new BeanSerializer(forType, NO_PROPS, null, null, null); }
/** * Method called to create {@link BeanSerializer} instance with * all accumulated information. Will construct a serializer if we * have enough information, or return null if not. */ public JsonSerializer<?> build() { BeanPropertyWriter[] properties; // No properties or any getter? No real serializer; caller gets to handle if (_properties == null || _properties.isEmpty()) { if (_anyGetter == null) { return null; } properties = NO_PROPERTIES; } else { properties = _properties.toArray(new BeanPropertyWriter[_properties.size()]); } return new BeanSerializer(_beanDesc.getType(), properties, _filteredProperties, _anyGetter, _filterId); }
/** * Method for constructing dummy bean deserializer; one that * never outputs any properties */ public static BeanSerializer createDummy(Class<?> forType) { return new BeanSerializer(forType, NO_PROPS, null, null, null); }
/** * Method called to create {@link BeanSerializer} instance with * all accumulated information. Will construct a serializer if we * have enough information, or return null if not. */ public JsonSerializer<?> build() { BeanPropertyWriter[] properties; // No properties or any getter? No real serializer; caller gets to handle if (_properties == null || _properties.isEmpty()) { if (_anyGetter == null) { return null; } properties = NO_PROPERTIES; } else { properties = _properties.toArray(new BeanPropertyWriter[_properties.size()]); } return new BeanSerializer(_beanDesc.getType(), properties, _filteredProperties, _anyGetter, _filterId); }
/** * Method for constructing dummy bean deserializer; one that * never outputs any properties */ public static BeanSerializer createDummy(Class<?> forType) { return new BeanSerializer(forType, NO_PROPS, null, null, null); }
/** * Method for constructing dummy bean deserializer; one that * never outputs any properties */ public static BeanSerializer createDummy(Class<?> forType) { return new BeanSerializer(forType, NO_PROPS); }
/** * Method used for constructing a filtered serializer instance, using this * serializer as the base. */ public BeanSerializer withFiltered(BeanPropertyWriter[] filtered) { // if no filters, no need to construct new instance... if (filtered == null) { return this; } return new BeanSerializer(_class, _props, filtered); }
/** * Method for constructing dummy bean deserializer; one that * never outputs any properties */ public static BeanSerializer createDummy(Class<?> forType) { return new BeanSerializer(forType, NO_PROPS, null, null, null); }
/** * Method for constructing dummy bean deserializer; one that * never outputs any properties */ public static BeanSerializer createDummy(Class<?> forType) { return new BeanSerializer(forType, NO_PROPS, null, null, null); }
/** * Method called to create {@link BeanSerializer} instance with * all accumulated information. */ public JsonSerializer<?> build() { BeanPropertyWriter[] properties = (_properties == null || _properties.isEmpty()) ? NO_PROPERTIES : _properties.toArray(new BeanPropertyWriter[_properties.size()]); return new BeanSerializer(_beanDesc.getType(), properties, _filteredProperties, _anyGetter, _filterId); }
/** * Method called to create {@link BeanSerializer} instance with * all accumulated information. Will construct a serializer if we * have enough information, or return null if not. */ public JsonSerializer<?> build() { BeanPropertyWriter[] properties; // No properties or any getter? No real serializer; caller gets to handle if (_properties == null || _properties.isEmpty()) { if (_anyGetter == null) { return null; } properties = NO_PROPERTIES; } else { properties = _properties.toArray(new BeanPropertyWriter[_properties.size()]); } return new BeanSerializer(_beanDesc.getType(), properties, _filteredProperties, _anyGetter, _filterId); }
/** * Method called to create {@link BeanSerializer} instance with * all accumulated information. Will construct a serializer if we * have enough information, or return null if not. */ public JsonSerializer<?> build() { BeanPropertyWriter[] properties; // No properties or any getter? No real serializer; caller gets to handle if (_properties == null || _properties.isEmpty()) { if (_anyGetter == null) { return null; } properties = NO_PROPERTIES; } else { properties = _properties.toArray(new BeanPropertyWriter[_properties.size()]); } return new BeanSerializer(_beanDesc.getType(), properties, _filteredProperties, _anyGetter, _filterId); }
/** * Method that will try to construct a {@link BeanSerializer} for * given class. Returns null if no properties are found. */ protected JsonSerializer<?> findBeanSerializer(Class<?> type) { // First things first: we know some types are not beans... if (!canBeABeanType(type)) { return null; } // First: what properties are to be serializable? Collection<WritableBeanProperty> props = findBeanProperties(type); if (props == null || props.size() == 0) { // No properties, no serializer return null; } return new BeanSerializer(type, props); }
protected JsonSerializer<Object> constructBeanSerializer(SerializationConfig config, BasicBeanDescription beanDesc) { // First: any detectable (auto-detect, annotations) properties to serialize? List<BeanPropertyWriter> props = findBeanProperties(config, beanDesc); if (props == null || props.size() == 0) { // No properties, no serializer /* 27-Nov-2009, tatu: Except that as per [JACKSON-201], we are * ok with that as long as it has a recognized class annotation * (which may come from a mix-in too) */ if (beanDesc.hasKnownClassAnnotations()) { return BeanSerializer.createDummy(beanDesc.classDescribed()); } return null; } // Any properties to suppress? props = filterBeanProperties(config, beanDesc, props); // Do they need to be sorted in some special way? props = sortBeanProperties(config, beanDesc, props); BeanSerializer ser = new BeanSerializer(beanDesc.classDescribed(), props); // One more thing: need to gather view information, if any: ser = processViews(config, beanDesc, ser, props); return ser; }