protected PojoPathState createState(Object initialPojo, String pojoPath, PojoPathMode mode, PojoPathContext context) {

    if (mode == null) {
      throw new NlsNullPointerException("mode");
    }
    Map<Object, Object> rawCache = context.getCache();
    if (rawCache == null) {
      CachingPojoPath rootPath = new CachingPojoPath(initialPojo, initialPojo.getClass());
      return new PojoPathState(rootPath, mode, pojoPath);
    }
    HashKey<Object> hashKey = new HashKey<>(initialPojo);
    PojoPathCache masterCache = (PojoPathCache) rawCache.get(hashKey);
    if (masterCache == null) {
      masterCache = new PojoPathCache(initialPojo);
      rawCache.put(hashKey, masterCache);
    }
    return masterCache.createState(mode, pojoPath);
  }
protected PojoPathState createState ( Object initialPojo , String pojoPath , PojoPathMode mode , PojoPathContext context ) { if ( mode == null ) { throw new NlsNullPointerException ( "mode" ) ; } Map < Object , Object > rawCache = context . getCache ( ) ; if ( rawCache == null ) { CachingPojoPath rootPath = new CachingPojoPath ( initialPojo , initialPojo . getClass ( ) ) ; return new PojoPathState ( rootPath , mode , pojoPath ) ; } HashKey < Object > hashKey = new HashKey < > ( initialPojo ) ; PojoPathCache masterCache = ( PojoPathCache ) rawCache . get ( hashKey ) ; if ( masterCache == null ) { masterCache = new PojoPathCache ( initialPojo ) ; rawCache . put ( hashKey , masterCache ) ; } return masterCache . createState ( mode , pojoPath ) ; }
This method gets the {@link PojoPathState} for the given {@code context}.

@param initialPojo is the initial {@link net.sf.mmm.util.pojo.api.Pojo} this {@link PojoPathNavigator} was invoked
with.
@param pojoPath is the {@link net.sf.mmm.util.pojo.path.api.PojoPath} to navigate.
@param mode is the {@link PojoPathMode mode} that determines how to deal {@code null} values.
@param context is the {@link PojoPathContext context} for this operation.
@return the {@link PojoPathState} or {@code null} if caching is disabled.