本文整理汇总了Java中org.codehaus.jackson.map.ser.BeanPropertyWriter类的典型用法代码示例。如果您正苦于以下问题:Java BeanPropertyWriter类的具体用法?Java BeanPropertyWriter怎么用?Java BeanPropertyWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeanPropertyWriter类属于org.codehaus.jackson.map.ser包,在下文中一共展示了BeanPropertyWriter类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: serializeAsField
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public void serializeAsField(Object bean, JsonGenerator jGen, SerializerProvider provider, BeanPropertyWriter writer) throws Exception {
if(bean instanceof HomePiUser){
HomePiUser user = (HomePiUser)bean;
Set<String> filterFields = new HashSet<String>();
filterFields.add("userName");
filterFields.add("email");
filterFields.add("locale");
filterFields.add("picLink");
filterFields.add("givenName");
filterFields.add("familyName");
filterFields.add("fullName");
SimpleBeanPropertyFilter.filterOutAllExcept(filterFields).serializeAsField(bean, jGen, provider, writer);
}
}
开发者ID:leeclarke,项目名称:homePi,代码行数:17,代码来源:HomePiUserTestFilter.java
示例2: setupModule
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public void setupModule(SetupContext context) {
context.addBeanSerializerModifier(new BeanSerializerModifier() {
@Override
public List<BeanPropertyWriter> changeProperties(SerializationConfig config,
BasicBeanDescription beanDesc, List<BeanPropertyWriter> beanProperties) {
ListIterator<BeanPropertyWriter> it = beanProperties.listIterator();
while (it.hasNext()) {
BeanPropertyWriter writer = it.next();
// replace the bean writer with my own if it is for "failed"
if (writer.getName().equals("failed")) {
BeanPropertyWriter newWriter = new IsFailedWriter(writer);
it.set(newWriter);
}
}
return beanProperties;
}
});
}
开发者ID:twitter-archive,项目名称:libcrunch,代码行数:19,代码来源:JsonTopologySerializer.java
示例3: BeanSerializerBase
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
/**
* @param type Nominal type of values handled by this serializer
* @param properties Property writers used for actual serialization
*/
protected BeanSerializerBase(JavaType type,
BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties,
AnyGetterWriter anyGetterWriter,
Object filterId)
{
super(type);
_props = properties;
_filteredProps = filteredProperties;
_anyGetterWriter = anyGetterWriter;
_propertyFilterId = filterId;
}
开发者ID:sumeetchhetri,项目名称:test-html-generator-plugin,代码行数:16,代码来源:BeanSerializerBase.java
示例4: serializeAsField
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider prov, BeanPropertyWriter writer) throws Exception {
if (bean instanceof LogData) {
Set<String> filterFields = new HashSet<String>();
filterFields.add("logKey");
filterFields.add("logMessage");
filterFields.add("createTime");
filterFields.add("logTypeId");
SimpleBeanPropertyFilter.filterOutAllExcept(filterFields).serializeAsField(bean, jgen, prov, writer);
}
}
开发者ID:leeclarke,项目名称:homePi,代码行数:12,代码来源:LogDataTestFilter.java
示例5: serializeAsField
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public void serializeAsField(Object bean, JsonGenerator jGen, SerializerProvider provider, BeanPropertyWriter writer) throws Exception {
if (bean instanceof PiProfile) {
Set<String> filterFields = new HashSet<String>();
filterFields.add("ipAddress");
filterFields.add("name");
filterFields.add("sshPortNumber");
filterFields.add("piSerialId");
filterFields.add("apiKey");
SimpleBeanPropertyFilter.filterOutAllExcept(filterFields).serializeAsField(bean, jGen, provider, writer);
}
}
开发者ID:leeclarke,项目名称:homePi,代码行数:14,代码来源:PiProfileTestFilter.java
示例6: serializeAsField
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public void serializeAsField(Object bean, JsonGenerator jGen, SerializerProvider provider, BeanPropertyWriter writer) throws Exception {
if (bean instanceof ManagedApp) {
Set<String> filterFields = new HashSet<String>();
filterFields.add("versionNumber");
filterFields.add("appName");
filterFields.add("fileName");
filterFields.add("deploymentPath");
SimpleBeanPropertyFilter.filterOutAllExcept(filterFields).serializeAsField(bean, jGen, provider, writer);
}
}
开发者ID:leeclarke,项目名称:homePi,代码行数:13,代码来源:ManagedAppTestFilter.java
示例7: BeanSerializerBase
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public BeanSerializerBase(Class<?> paramClass, BeanPropertyWriter[] paramArrayOfBeanPropertyWriter1, BeanPropertyWriter[] paramArrayOfBeanPropertyWriter2, AnyGetterWriter paramAnyGetterWriter, Object paramObject)
{
super(paramClass);
this._props = paramArrayOfBeanPropertyWriter1;
this._filteredProps = paramArrayOfBeanPropertyWriter2;
this._anyGetterWriter = paramAnyGetterWriter;
this._propertyFilterId = paramObject;
}
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:9,代码来源:BeanSerializerBase.java
示例8: withSerializer
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public BeanPropertyWriter withSerializer(JsonSerializer<Object> paramJsonSerializer)
{
if (getClass() != UnwrappingBeanPropertyWriter.class)
throw new IllegalStateException("UnwrappingBeanPropertyWriter sub-class does not override 'withSerializer()'; needs to!");
if (!paramJsonSerializer.isUnwrappingSerializer())
paramJsonSerializer = paramJsonSerializer.unwrappingSerializer();
return new UnwrappingBeanPropertyWriter(this, paramJsonSerializer);
}
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:9,代码来源:UnwrappingBeanPropertyWriter.java
示例9: UniqueIdPropertyWriter
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
protected UniqueIdPropertyWriter(BeanPropertyWriter base)
{
super(base);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:5,代码来源:UniqueIdPropertyWriter.java
示例10: withSerializer
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
/**
* We have to override this!
*/
@Override
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
{
return new UniqueIdPropertyWriter(this, ser);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:9,代码来源:UniqueIdPropertyWriter.java
示例11: serializeAsField
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
@Override
public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider provider, BeanPropertyWriter writer) throws Exception
{
writer.serializeAsField(bean, jgen, provider);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:6,代码来源:JacksonHelper.java
示例12: getSchema
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
throws JsonMappingException
{
ObjectNode o = createSchemaNode("object", true);
//todo: should the classname go in the title?
//o.put("title", _className);
ObjectNode propertiesNode = o.objectNode();
for (int i = 0; i < _props.length; i++) {
BeanPropertyWriter prop = _props[i];
JavaType propType = prop.getSerializationType();
// 03-Dec-2010, tatu: SchemaAware REALLY should use JavaType, but alas it doesn't...
Type hint = (propType == null) ? prop.getGenericPropertyType() : propType.getRawClass();
// Maybe it already has annotated/statically configured serializer?
JsonSerializer<Object> ser = prop.getSerializer();
if (ser == null) { // nope
Class<?> serType = prop.getRawSerializationType();
if (serType == null) {
serType = prop.getPropertyType();
}
ser = provider.findValueSerializer(serType, prop);
}
JsonNode schemaNode = (ser instanceof SchemaAware) ?
((SchemaAware) ser).getSchema(provider, hint) :
JsonSchema.getDefaultSchemaNode();
if(prop.getAnnotation(XmlAttribute.class)!=null && schemaNode instanceof ObjectNode)
((ObjectNode)schemaNode).put("isattr", true);
propertiesNode.put(prop.getName(), schemaNode);
}
o.put("properties", propertiesNode);
if(typeHint instanceof Class)
{
Class<?> claz = (Class<?>)typeHint;
if(claz.getAnnotation(XmlRootElement.class)!=null
&& !claz.getAnnotation(XmlRootElement.class).name().equals("##default"))
o.put("name", claz.getAnnotation(XmlRootElement.class).name());
else if(claz.getAnnotation(XmlType.class)!=null
&& !claz.getAnnotation(XmlType.class).name().equals("##default"))
o.put("name", claz.getAnnotation(XmlType.class).name());
else
o.put("name", claz.getSimpleName());
}
return o;
}
开发者ID:sumeetchhetri,项目名称:test-html-generator-plugin,代码行数:45,代码来源:BeanSerializerBase.java
示例13: resolve
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
@Override
public void resolve(SerializerProvider provider)
throws JsonMappingException
{
int filteredCount = (_filteredProps == null) ? 0 : _filteredProps.length;
for (int i = 0, len = _props.length; i < len; ++i) {
BeanPropertyWriter prop = _props[i];
if (prop.hasSerializer()) {
continue;
}
// Was the serialization type hard-coded? If so, use it
JavaType type = prop.getSerializationType();
/* It not, we can use declared return type if and only if
* declared type is final -- if not, we don't really know
* the actual type until we get the instance.
*/
if (type == null) {
type = provider.constructType(prop.getGenericPropertyType());
if (!type.isFinal()) {
/* 18-Feb-2010, tatus: But even if it is non-final, we may
* need to retain some of type information so that we can
* accurately handle contained types
*/
if (type.isContainerType() || type.containedTypeCount() > 0) {
prop.setNonTrivialBaseType(type);
}
continue;
}
}
JsonSerializer<Object> ser = provider.findValueSerializer(type, prop);
/* 04-Feb-2010, tatu: We may have stashed type serializer for content types
* too, earlier; if so, it's time to connect the dots here:
*/
if (type.isContainerType()) {
TypeSerializer typeSer = type.getContentType().getTypeHandler();
if (typeSer != null) {
// for now, can do this only for standard containers...
if (ser instanceof ContainerSerializerBase<?>) {
// ugly casts... but necessary
@SuppressWarnings("unchecked")
JsonSerializer<Object> ser2 = (JsonSerializer<Object>)((ContainerSerializerBase<?>) ser).withValueTypeSerializer(typeSer);
ser = ser2;
}
}
}
prop = prop.withSerializer(ser);
_props[i] = prop;
// and maybe replace filtered property too? (see [JACKSON-364])
if (i < filteredCount) {
BeanPropertyWriter w2 = _filteredProps[i];
if (w2 != null) {
_filteredProps[i] = w2.withSerializer(ser);
}
}
}
// also, any-getter may need to be resolved
if (_anyGetterWriter != null) {
_anyGetterWriter.resolve(provider);
}
}
开发者ID:sumeetchhetri,项目名称:test-html-generator-plugin,代码行数:63,代码来源:BeanSerializerBase.java
示例14: serializeAsField
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public void serializeAsField(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, BeanPropertyWriter paramBeanPropertyWriter)
throws Exception
{
if (this._propertiesToInclude.contains(paramBeanPropertyWriter.getName()))
paramBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
}
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:7,代码来源:SimpleBeanPropertyFilter.java
示例15: IsFailedWriter
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public IsFailedWriter(BeanPropertyWriter base) {
super(base);
}
开发者ID:twitter-archive,项目名称:libcrunch,代码行数:4,代码来源:JsonTopologySerializer.java
示例16: withSerializer
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
@Override
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser) {
return new IsFailedWriter(this, ser);
}
开发者ID:twitter-archive,项目名称:libcrunch,代码行数:5,代码来源:JsonTopologySerializer.java
示例17: serializeFields
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
protected void serializeFields(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
{
BeanPropertyWriter[] arrayOfBeanPropertyWriter;
if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
arrayOfBeanPropertyWriter = this._filteredProps;
int i;
JsonMappingException localJsonMappingException;
while (true)
{
i = 0;
try
{
int j = arrayOfBeanPropertyWriter.length;
while (true)
if (i < j)
{
BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
if (localBeanPropertyWriter != null)
localBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
i++;
continue;
arrayOfBeanPropertyWriter = this._props;
break;
}
if (this._anyGetterWriter != null)
this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
return;
}
catch (Exception localException)
{
if (i == arrayOfBeanPropertyWriter.length);
for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
{
wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
return;
}
}
catch (StackOverflowError localStackOverflowError)
{
localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
if (i != arrayOfBeanPropertyWriter.length);
}
}
for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
{
localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
throw localJsonMappingException;
}
}
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:50,代码来源:BeanSerializerBase.java
示例18: UnwrappingBeanPropertyWriter
import org.codehaus.jackson.map.ser.BeanPropertyWriter; //导入依赖的package包/类
public UnwrappingBeanPropertyWriter(BeanPropertyWriter paramBeanPropertyWriter)
{
super(paramBeanPropertyWriter);
}
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:5,代码来源:UnwrappingBeanPropertyWriter.java
注:本文中的org.codehaus.jackson.map.ser.BeanPropertyWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论