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


Java ObjectIdGenerator类代码示例

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


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

示例1: resolveId

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
@Override
public Object resolveId(final ObjectIdGenerator.IdKey id) {
    Object entity = repository.findOne((Long) id.key);

    if (entity == null) {
        throw new BusinessException(ErrorConstants.ERR_NOTFOUND, "Can not resolve XmEntity by ID: " + id.key);
    }

    return entity;
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:11,代码来源:XmEntityObjectIdResolver.java

示例2: findObjectId

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
public ReadableObjectId findObjectId(Object paramObject, ObjectIdGenerator<?> paramObjectIdGenerator)
{
  ObjectIdGenerator.IdKey localIdKey = paramObjectIdGenerator.key(paramObject);
  if (this._objectIds == null)
  {
    this._objectIds = new LinkedHashMap();
  }
  else
  {
    ReadableObjectId localReadableObjectId1 = (ReadableObjectId)this._objectIds.get(localIdKey);
    if (localReadableObjectId1 != null)
      return localReadableObjectId1;
  }
  ReadableObjectId localReadableObjectId2 = new ReadableObjectId(paramObject);
  this._objectIds.put(localIdKey, localReadableObjectId2);
  return localReadableObjectId2;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:DefaultDeserializationContext.java

示例3: objectIdGeneratorInstance

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
@Override
public ObjectIdGenerator<?> objectIdGeneratorInstance(Annotated annotated,
        ObjectIdInfo objectIdInfo)
    throws JsonMappingException
{
    Class<?> implClass = objectIdInfo.getGeneratorType();
    HandlerInstantiator hi = _config.getHandlerInstantiator();
    ObjectIdGenerator<?> gen;

    if (hi != null) {
        gen =  hi.objectIdGeneratorInstance(_config, annotated, implClass);
    } else {
        gen = (ObjectIdGenerator<?>) ClassUtil.createInstance(implClass,
                _config.canOverrideAccessModifiers());
    }
    return gen.forScope(objectIdInfo.getScope());
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:18,代码来源:DefaultSerializerProvider.java

示例4: canUseFor

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
/**
 * We must override this method, to prevent errors when scopes are the same,
 * but underlying class (on which to access property) is different.
 */
@Override
public boolean canUseFor(ObjectIdGenerator<?> gen) {
    if (gen.getClass() == getClass()) {
        PropertyBasedObjectIdGenerator other = (PropertyBasedObjectIdGenerator) gen;
        if (other.getScope() == _scope) {
            /* 26-Jul-2012, tatu: This is actually not enough, because the property
             *   accessor within BeanPropertyWriter won't work for other property fields
             *  (see [https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/9]
             *  for details).
             *  So we need to verify that underlying property is actually the same.
             */
            return (other._property == _property);
        }
    }
    return false;
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:21,代码来源:PropertyBasedObjectIdGenerator.java

示例5: objectIdGeneratorInstance

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
@Override
public ObjectIdGenerator<?> objectIdGeneratorInstance(Annotated annotated,
        ObjectIdInfo objectIdInfo)
    throws JsonMappingException
{
    Class<?> implClass = objectIdInfo.getGeneratorType();
    HandlerInstantiator hi = _config.getHandlerInstantiator();
    ObjectIdGenerator<?> gen;

    if (hi != null) {
        gen = hi.objectIdGeneratorInstance(_config, annotated, implClass);
    } else {
        gen = (ObjectIdGenerator<?>) ClassUtil.createInstance(implClass,
                _config.canOverrideAccessModifiers());
    }
    return gen.forScope(objectIdInfo.getScope());
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:18,代码来源:DefaultDeserializationContext.java

示例6: resolveId

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
@Override
public Object resolveId(final ObjectIdGenerator.IdKey id) {
    Object entity = repository.findOne((Long) id.key);

    if (entity == null) {
        throw new BusinessException(ErrorConstants.ERR_NOTFOUND, "Can not resolve Calendar by ID: " + id.key);
    }

    return entity;
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:11,代码来源:CalendarObjectIdResolver.java

示例7: addGenerator

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
/**
 * Used by generated {@link AbstractBeanJsonSerializer}
 *
 * @param generator instance of generator to add
 */
@Override
@SuppressWarnings("UnusedDeclaration")
public void addGenerator(ObjectIdGenerator<?> generator) {
    if (null == generators) {
        generators = new ArrayList<ObjectIdGenerator<?>>();
    }
    generators.add(generator);
}
 
开发者ID:vegegoku,项目名称:gwt-jackson-apt,代码行数:14,代码来源:DefaultJsonSerializationContext.java

示例8: findObjectIdGenerator

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
/**
 * Used by generated {@link AbstractBeanJsonSerializer}
 *
 * @param gen generator used to find equivalent generator
 * @param <T> a T object.
 * @return a {@link com.fasterxml.jackson.annotation.ObjectIdGenerator} object.
 */
@Override
@SuppressWarnings({"UnusedDeclaration", "unchecked"})
public <T> ObjectIdGenerator<T> findObjectIdGenerator(ObjectIdGenerator<T> gen) {
    if (null != generators) {
        for (ObjectIdGenerator<?> generator : generators) {
            if (generator.canUseFor(gen)) {
                return (ObjectIdGenerator<T>) generator;
            }
        }
    }
    return null;
}
 
开发者ID:vegegoku,项目名称:gwt-jackson-apt,代码行数:20,代码来源:DefaultJsonSerializationContext.java

示例9: objectIdGeneratorInstance

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
@Override
public ObjectIdGenerator<?> objectIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass) {
	if(annotated.getRawType().equals(TokenList.class)) {
		return tokenIdGenerator;
	} else {
		return null;
	}
}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:9,代码来源:WorkloadHandlerInstantiator.java

示例10: constructObjectIdHandler

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
protected ObjectIdWriter constructObjectIdHandler(SerializerProvider paramSerializerProvider, BeanDescription paramBeanDescription, List<BeanPropertyWriter> paramList)
{
  ObjectIdInfo localObjectIdInfo = paramBeanDescription.getObjectIdInfo();
  if (localObjectIdInfo == null)
    return null;
  Class localClass = localObjectIdInfo.getGeneratorType();
  if (localClass == ObjectIdGenerators.PropertyGenerator.class)
  {
    String str = localObjectIdInfo.getPropertyName();
    int i = 0;
    int j = paramList.size();
    BeanPropertyWriter localBeanPropertyWriter;
    while (true)
    {
      if (i == j)
        throw new IllegalArgumentException("Invalid Object Id definition for " + paramBeanDescription.getBeanClass().getName() + ": can not find property with name '" + str + "'");
      localBeanPropertyWriter = (BeanPropertyWriter)paramList.get(i);
      if (str.equals(localBeanPropertyWriter.getName()))
      {
        if (i <= 0)
          break;
        paramList.remove(i);
        paramList.add(0, localBeanPropertyWriter);
        break;
      }
      i++;
    }
    return ObjectIdWriter.construct(localBeanPropertyWriter.getType(), null, new PropertyBasedObjectIdGenerator(localObjectIdInfo, localBeanPropertyWriter), localObjectIdInfo.getAlwaysAsId());
  }
  JavaType localJavaType1 = paramSerializerProvider.constructType(localClass);
  JavaType localJavaType2 = paramSerializerProvider.getTypeFactory().findTypeParameters(localJavaType1, ObjectIdGenerator.class)[0];
  ObjectIdGenerator localObjectIdGenerator = paramSerializerProvider.objectIdGeneratorInstance(paramBeanDescription.getClassInfo(), localObjectIdInfo);
  return ObjectIdWriter.construct(localJavaType2, localObjectIdInfo.getPropertyName(), localObjectIdGenerator, localObjectIdInfo.getAlwaysAsId());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:35,代码来源:BeanSerializerFactory.java

示例11: ObjectIdWriter

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
protected ObjectIdWriter(JavaType paramJavaType, SerializedString paramSerializedString, ObjectIdGenerator<?> paramObjectIdGenerator, JsonSerializer<?> paramJsonSerializer, boolean paramBoolean)
{
  this.idType = paramJavaType;
  this.propertyName = paramSerializedString;
  this.generator = paramObjectIdGenerator;
  this.serializer = paramJsonSerializer;
  this.alwaysAsId = paramBoolean;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:9,代码来源:ObjectIdWriter.java

示例12: canUseFor

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
public boolean canUseFor(ObjectIdGenerator<?> paramObjectIdGenerator)
{
  if (paramObjectIdGenerator.getClass() == getClass())
  {
    PropertyBasedObjectIdGenerator localPropertyBasedObjectIdGenerator = (PropertyBasedObjectIdGenerator)paramObjectIdGenerator;
    if (localPropertyBasedObjectIdGenerator.getScope() == this._scope)
      return localPropertyBasedObjectIdGenerator._property == this._property;
  }
  return false;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:PropertyBasedObjectIdGenerator.java

示例13: ObjectIdInfo

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
protected ObjectIdInfo(String paramString, Class<?> paramClass, Class<? extends ObjectIdGenerator<?>> paramClass1, boolean paramBoolean)
{
  this._propertyName = paramString;
  this._scope = paramClass;
  this._generator = paramClass1;
  this._alwaysAsId = paramBoolean;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:ObjectIdInfo.java

示例14: ObjectIdReader

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
protected ObjectIdReader(JavaType paramJavaType, String paramString, ObjectIdGenerator<?> paramObjectIdGenerator, JsonDeserializer<?> paramJsonDeserializer, SettableBeanProperty paramSettableBeanProperty)
{
  this.idType = paramJavaType;
  this.propertyName = paramString;
  this.generator = paramObjectIdGenerator;
  this.deserializer = paramJsonDeserializer;
  this.idProperty = paramSettableBeanProperty;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:9,代码来源:ObjectIdReader.java

示例15: addObjectIdReader

import com.fasterxml.jackson.annotation.ObjectIdGenerator; //导入依赖的package包/类
protected void addObjectIdReader(DeserializationContext paramDeserializationContext, BeanDescription paramBeanDescription, BeanDeserializerBuilder paramBeanDeserializerBuilder)
{
  ObjectIdInfo localObjectIdInfo = paramBeanDescription.getObjectIdInfo();
  if (localObjectIdInfo == null)
    return;
  Class localClass = localObjectIdInfo.getGeneratorType();
  SettableBeanProperty localSettableBeanProperty1;
  JavaType localJavaType2;
  Object localObject;
  if (localClass == ObjectIdGenerators.PropertyGenerator.class)
  {
    String str = localObjectIdInfo.getPropertyName();
    SettableBeanProperty localSettableBeanProperty2 = paramBeanDeserializerBuilder.findProperty(str);
    localSettableBeanProperty1 = localSettableBeanProperty2;
    if (localSettableBeanProperty2 == null)
      throw new IllegalArgumentException("Invalid Object Id definition for " + paramBeanDescription.getBeanClass().getName() + ": can not find property with name '" + str + "'");
    localJavaType2 = localSettableBeanProperty1.getType();
    localObject = new PropertyBasedObjectIdGenerator(localObjectIdInfo.getScope());
  }
  else
  {
    JavaType localJavaType1 = paramDeserializationContext.constructType(localClass);
    localJavaType2 = paramDeserializationContext.getTypeFactory().findTypeParameters(localJavaType1, ObjectIdGenerator.class)[0];
    localSettableBeanProperty1 = null;
    localObject = paramDeserializationContext.objectIdGeneratorInstance(paramBeanDescription.getClassInfo(), localObjectIdInfo);
  }
  JsonDeserializer localJsonDeserializer = paramDeserializationContext.findRootValueDeserializer(localJavaType2);
  paramBeanDeserializerBuilder.setObjectIdReader(ObjectIdReader.construct(localJavaType2, localObjectIdInfo.getPropertyName(), (ObjectIdGenerator)localObject, localJsonDeserializer, localSettableBeanProperty1));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:30,代码来源:BeanDeserializerFactory.java


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