public Maker from ( Settable settable ) { Optional < Maker < ? > > makerOptional = context . getPreferredValueMakers ( ) . getMaker ( settable ) ; if ( makerOptional . isPresent ( ) ) { return makerOptional . get ( ) ; } Type type = settable . getType ( ) ; Class < ? > rawType = ClassUtil . getRawType ( type ) ; if ( ClassUtil . isPrimitive ( type ) ) { return new PrimitiveMaker ( type ) ; } if ( type == String . class ) { return StringMaker . from ( settable ) ; } if ( type == Date . class ) { return new DateMaker ( ) ; } if ( Number . class . isAssignableFrom ( rawType ) ) { return NumberMaker . from ( settable ) ; } if ( ClassUtil . isArray ( type ) ) { log . trace ( "array type: {}" , rawType . getComponentType ( ) ) ; return new NullMaker ( ) ; } if ( ClassUtil . isEnum ( type ) ) { log . trace ( "enum type: {}" , type ) ; return new EnumMaker ( rawType . getEnumConstants ( ) ) ; } if ( ClassUtil . isCollection ( type ) ) { log . trace ( "collection: {}" , type ) ; return new NullMaker ( ) ; } if ( ClassUtil . isMap ( type ) ) { log . trace ( "map: {}" , type ) ; return new NullMaker < Object > ( ) ; } if ( ClassUtil . isEntity ( type ) ) { log . trace ( "{} is entity type" , type ) ; // we don't want to make unnecessary entities // @see EntityMakerBuilder return new ReuseOrNullMaker ( context . getBeanValueHolder ( ) , rawType ) ; } log . debug ( "guessing this is a bean {}" , type ) ; return new BeanMaker ( rawType , context ) ; }
produce a maker for given settable