• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MaxKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addCommonSerializers

import org.bson.types.MaxKey; //导入依赖的package包/类
static ClassMapBasedObjectSerializer addCommonSerializers() {
    ClassMapBasedObjectSerializer serializer = new ClassMapBasedObjectSerializer();

    serializer.addObjectSerializer(Object[].class, new ObjectArraySerializer(serializer));
    serializer.addObjectSerializer(Boolean.class, new ToStringSerializer());
    serializer.addObjectSerializer(Code.class, new CodeSerializer(serializer));
    serializer.addObjectSerializer(CodeWScope.class, new CodeWScopeSerializer(serializer));
    serializer.addObjectSerializer(DBObject.class, new DBObjectSerializer(serializer));
    serializer.addObjectSerializer(DBRefBase.class, new DBRefBaseSerializer(serializer));
    serializer.addObjectSerializer(Iterable.class, new IterableSerializer(serializer));
    serializer.addObjectSerializer(Map.class, new MapSerializer(serializer));
    serializer.addObjectSerializer(MaxKey.class, new MaxKeySerializer(serializer));
    serializer.addObjectSerializer(MinKey.class, new MinKeySerializer(serializer));
    serializer.addObjectSerializer(Number.class, new ToStringSerializer());
    serializer.addObjectSerializer(ObjectId.class, new ObjectIdSerializer(serializer));
    serializer.addObjectSerializer(Pattern.class, new PatternSerializer(serializer));
    serializer.addObjectSerializer(String.class, new StringSerializer());
    serializer.addObjectSerializer(UUID.class, new UUIDSerializer(serializer));
    return serializer;
}
 
开发者ID:MaOrKsSi,项目名称:HZS.Durian,代码行数:21,代码来源:JSONSerializers.java


示例2: Chunk

import org.bson.types.MaxKey; //导入依赖的package包/类
/**
 * @param pMin
 *            an Object representing the minimum value of the Chunk range or
 *            null if this is the lowest range
 * @param pMax
 *            an Object representing the minimum value of the Chunk range or
 *            null if this is the lowest range
 * @param pShard
 *            the name of the Shard this Chunk belongs to
 */
public Chunk(Object pMin, Object pMax, String pShard) {
	DBObject min = (DBObject) pMin, max = (DBObject) pMax;
	_shardkey = max.toMap().keySet().toArray()[0].toString();
	_shard = pShard;

	@SuppressWarnings("rawtypes")
	Iterator it = max.toMap().values().iterator();
	_max = it.next();
	if (_max instanceof MaxKey) {
		_max = null;
	}

	it = min.toMap().values().iterator();
	_min = it.next();
	if (_min instanceof MinKey) {
		_min = null;
	}
}
 
开发者ID:rhoulihan,项目名称:resharder,代码行数:29,代码来源:Chunk.java


示例3: mongoToKettleType

import org.bson.types.MaxKey; //导入依赖的package包/类
protected static int mongoToKettleType( Object fieldValue ) {
  if ( fieldValue == null ) {
    return ValueMetaInterface.TYPE_STRING;
  }

  if ( fieldValue instanceof Symbol || fieldValue instanceof String || fieldValue instanceof Code
        || fieldValue instanceof ObjectId || fieldValue instanceof MinKey || fieldValue instanceof MaxKey ) {
    return ValueMetaInterface.TYPE_STRING;
  } else if ( fieldValue instanceof Date ) {
    return ValueMetaInterface.TYPE_DATE;
  } else if ( fieldValue instanceof Number ) {
    // try to parse as an Integer
    try {
      Integer.parseInt( fieldValue.toString() );
      return ValueMetaInterface.TYPE_INTEGER;
    } catch ( NumberFormatException e ) {
      return ValueMetaInterface.TYPE_NUMBER;
    }
  } else if ( fieldValue instanceof Binary ) {
    return ValueMetaInterface.TYPE_BINARY;
  } else if ( fieldValue instanceof BSONTimestamp ) {
    return ValueMetaInterface.TYPE_INTEGER;
  }

  return ValueMetaInterface.TYPE_STRING;
}
 
开发者ID:pentaho,项目名称:pentaho-mongodb-plugin,代码行数:27,代码来源:MongodbInputDiscoverFieldsImpl.java


示例4: convert

import org.bson.types.MaxKey; //导入依赖的package包/类
/**
 * convert bson types to java primitives. BasicBSONList, Binary,
 * BSONTimestamp, Code, CodeWScope, MinKey, MaxKey, Symbol, ObjectId
 */
private Object convert(Object o) {
	if (o instanceof BSONTimestamp) {
		return ((BSONTimestamp) o).getTime();
	} else if (o instanceof Symbol || o instanceof Code || o instanceof CodeWScope || o instanceof MinKey
			|| o instanceof MaxKey || o instanceof ObjectId) {
		return o.toString();
	} else if (o instanceof BasicBSONList) {
		List<Object> l = new ArrayList<Object>();
		for (Object item : ((BasicBSONList) o)) {
			l.add(convert(item));
		}

		return l;
	} else {
		return o;
	}
}
 
开发者ID:araqne,项目名称:logdb,代码行数:22,代码来源:MongoFindCommand.java


示例5: checkValue

import org.bson.types.MaxKey; //导入依赖的package包/类
protected void checkValue(Object value) {
	if (value instanceof MObject)
		return;

	if (value == null)
		return;
	if (value instanceof Number)
		return;
	if (value instanceof String)
		return;
	if (value instanceof Boolean)
		return;
	if (value instanceof Character)
		return;
	if (value instanceof ObjectId)
		return;
	if (value instanceof Date)
		return;
	if (value instanceof Pattern)
		return;
	if (value instanceof UUID)
		return;
	if (value instanceof MaxKey || value instanceof MinKey)
		return;
	if (value instanceof byte[])
		return;
	if (value instanceof BSONTimestamp || value instanceof Symbol
		|| value instanceof Code || value instanceof CodeWScope)
		return;

	throw new IllegalArgumentException(getClass().getSimpleName()
		+ " can't store a " + value.getClass().getName());
}
 
开发者ID:judison,项目名称:mongodm,代码行数:34,代码来源:MObject.java


示例6: decode

import org.bson.types.MaxKey; //导入依赖的package包/类
@Override
public MaxKey decode(BsonValue bsonValue) {
    return new MaxKey();
}
 
开发者ID:welkinbai,项目名称:BsonMapper,代码行数:5,代码来源:BsonMaxKeyConverter.java


示例7: encode

import org.bson.types.MaxKey; //导入依赖的package包/类
@Override
public BsonMaxKey encode(MaxKey object) {
    return new BsonMaxKey();
}
 
开发者ID:welkinbai,项目名称:BsonMapper,代码行数:5,代码来源:BsonMaxKeyConverter.java


示例8: gotMaxKey

import org.bson.types.MaxKey; //导入依赖的package包/类
public void gotMaxKey( String name ){
    cur().put( name , new MaxKey() );
}
 
开发者ID:MaOrKsSi,项目名称:HZS.Durian,代码行数:4,代码来源:BasicBSONCallback.java


示例9: _putObjectField

import org.bson.types.MaxKey; //导入依赖的package包/类
protected void _putObjectField( String name , Object val ){

        if ( name.equals( "_transientFields" ) )
            return;
        
        if ( DEBUG ) System.out.println( "\t put thing : " + name );

        if ( name.contains( "\0" ) )
            throw new IllegalArgumentException( "Document field names can't have a NULL character. (Bad Key: '" + name + "')" );
        
        if ( name.equals( "$where") && val instanceof String ){
            _put( CODE , name );
            _putValueString( val.toString() );
            return;
        }
        
        val = BSON.applyEncodingHooks( val );

        if ( val == null )
            putNull(name);
        else if ( val instanceof Date )
            putDate( name , (Date)val );
        else if ( val instanceof Number )
            putNumber(name, (Number)val );
        else if ( val instanceof Character )
            putString(name, val.toString() );
        else if ( val instanceof String )
            putString(name, val.toString() );
        else if ( val instanceof ObjectId )
            putObjectId(name, (ObjectId)val );
        else if ( val instanceof BSONObject )
            putObject(name, (BSONObject)val );
        else if ( val instanceof Boolean )
            putBoolean(name, (Boolean)val );
        else if ( val instanceof Pattern )
            putPattern(name, (Pattern)val );
        else if ( val instanceof Map )
            putMap( name , (Map)val );
        else if ( val instanceof Iterable)
            putIterable( name , (Iterable)val );
        else if ( val instanceof byte[] )
            putBinary( name , (byte[])val );
        else if ( val instanceof Binary )
            putBinary( name , (Binary)val );
        else if ( val instanceof UUID )
            putUUID( name , (UUID)val );
        else if ( val.getClass().isArray() )
        	putArray( name , val );

        else if (val instanceof Symbol) {
            putSymbol(name, (Symbol) val);
        }
        else if (val instanceof BSONTimestamp) {
            putTimestamp( name , (BSONTimestamp)val );
        }
        else if (val instanceof CodeWScope) {
            putCodeWScope( name , (CodeWScope)val );
        }
        else if (val instanceof Code) {
            putCode( name , (Code)val );
        }
        else if (val instanceof DBRefBase) {
            BSONObject temp = new BasicBSONObject();
            temp.put("$ref", ((DBRefBase)val).getRef());
            temp.put("$id", ((DBRefBase)val).getId());
            putObject( name, temp );
        }
        else if ( val instanceof MinKey )
            putMinKey( name );
        else if ( val instanceof MaxKey )
            putMaxKey( name );
        else if ( putSpecial( name , val ) ){
            // no-op
        }
        else {
            throw new IllegalArgumentException( "can't serialize " + val.getClass() );
        }
        
    }
 
开发者ID:MaOrKsSi,项目名称:HZS.Durian,代码行数:80,代码来源:BasicBSONEncoder.java


示例10: getElementValue

import org.bson.types.MaxKey; //导入依赖的package包/类
/**
 * @deprecated This method is NOT a part of public API and will be dropped in 3.x versions.
 */
@Deprecated
protected Object getElementValue( ElementRecord record ){
    switch ( record.type ){
        case BSON.EOO:
        case BSON.UNDEFINED:
        case BSON.NULL:
            return null;
        case BSON.MAXKEY:
            return new MaxKey();
        case BSON.MINKEY:
            return new MinKey();
        case BSON.BOOLEAN:
            return ( _input.get( record.valueOffset ) != 0 );
        case BSON.NUMBER_INT:
            return _input.getInt( record.valueOffset );
        case BSON.TIMESTAMP:
            int inc = _input.getInt( record.valueOffset );
            int time = _input.getInt( record.valueOffset + 4 );
            return new BSONTimestamp( time, inc );
        case BSON.DATE:
            return new Date( _input.getLong( record.valueOffset ) );
        case BSON.NUMBER_LONG:
            return _input.getLong( record.valueOffset );
        case BSON.NUMBER:
            return Double.longBitsToDouble( _input.getLong( record.valueOffset ) );
        case BSON.OID:
            return new ObjectId( _input.getIntBE( record.valueOffset ),
                                 _input.getIntBE( record.valueOffset + 4 ),
                                 _input.getIntBE( record.valueOffset + 8 ) );
        case BSON.SYMBOL:
            return new Symbol( _input.getUTF8String( record.valueOffset ) );
        case BSON.CODE:
            return new Code( _input.getUTF8String( record.valueOffset ) );
        case BSON.STRING:
            return _input.getUTF8String( record.valueOffset );
        case BSON.CODE_W_SCOPE:
            int strsize = _input.getInt( record.valueOffset + 4 );
            String code = _input.getUTF8String( record.valueOffset + 4 );
            BSONObject scope =
                    (BSONObject) _callback.createObject( _input.array(), record.valueOffset + 4 + 4 + strsize );
            return new CodeWScope( code, scope );
        case BSON.REF:
            int csize = _input.getInt( record.valueOffset );
            String ns = _input.getCString( record.valueOffset + 4 );
            int oidOffset = record.valueOffset + csize + 4;
            ObjectId oid = new ObjectId( _input.getIntBE( oidOffset ),
                                         _input.getIntBE( oidOffset + 4 ),
                                         _input.getIntBE( oidOffset + 8 ) );
            return _callback.createDBRef( ns, oid );
        case BSON.OBJECT:
            return _callback.createObject( _input.array(), record.valueOffset );
        case BSON.ARRAY:
            return _callback.createArray( _input.array(), record.valueOffset );
        case BSON.BINARY:
            return readBinary( record.valueOffset );
        case BSON.REGEX:
            int patternCStringSize = sizeCString( record.valueOffset );
            String pattern = _input.getCString( record.valueOffset );
            String flags = _input.getCString( record.valueOffset + patternCStringSize );
            return Pattern.compile( pattern, BSON.regexFlags( flags ) );
        default:
            throw new BSONException(
                    "Invalid type " + record.type + " for field " + getElementFieldName( record.offset ) );
    }
}
 
开发者ID:MaOrKsSi,项目名称:HZS.Durian,代码行数:69,代码来源:LazyBSONObject.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IndicesAliasesRequest类代码示例发布时间:2022-05-22
下一篇:
Java ParticleEffect类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap