/** * Creates a new instance of DBaseFileReader * * @param channel The readable channel to use. * @param useMemoryMappedBuffer Wether or not map the file in memory * @throws IOException If an error occurs while initializing. */ public IndexedDbaseFileReader(ShpFiles shpFiles, boolean useMemoryMappedBuffer) throws IOException { super( shpFiles, useMemoryMappedBuffer, (Charset) ShapefileDataStoreFactory.DBFCHARSET.getDefaultValue(), TimeZone.getDefault()); }
public ElasticFeatureReader(ContentState contentState, List<ElasticHit> hits, Map<String,ElasticAggregation> aggregations, float maxScore) { this.state = contentState; this.featureType = state.getFeatureType(); this.searchHitIterator = hits.iterator(); this.builder = new SimpleFeatureBuilder(featureType); this.parserUtil = new ElasticParserUtil(); this.maxScore = maxScore; this.aggregationIterator = Collections.emptyIterator(); if (aggregations != null && !aggregations.isEmpty()) { String aggregationName = aggregations.keySet().stream().findFirst().orElse(null); if (aggregations.size() > 1) { LOGGER.info("Result has multiple aggregations. Using " + aggregationName); } if (aggregations.get(aggregationName).getBuckets() != null) { this.aggregationIterator = aggregations.get(aggregationName).getBuckets().iterator(); } } if (contentState.getEntry() != null && contentState.getEntry().getDataStore() != null) { final ElasticDataStore dataStore; dataStore = (ElasticDataStore) contentState.getEntry().getDataStore(); this.arrayEncoding = dataStore.getArrayEncoding(); } else { this.arrayEncoding = ArrayEncoding.valueOf((String) ElasticDataStoreFactory.ARRAY_ENCODING.getDefaultValue()); } this.mapper = new ObjectMapper(); }
gridSize = dataStore.getGridSize(); } else { gridSize = (Long) ElasticDataStoreFactory.GRID_SIZE.getDefaultValue(); gridThreshold = dataStore.getGridThreshold(); } else { gridThreshold = (Double) ElasticDataStoreFactory.GRID_THRESHOLD.getDefaultValue();
/** * Looks up a parameter, if not found it returns the default value, assuming there is one, or * null otherwise * * @param <T> * @param param * @param params * @param target * @return * @throws IOException */ <T> T lookup(Param param, Map<String, Serializable> params, Class<T> target) throws IOException { T result = (T) param.lookUp(params); if (result == null) { return (T) param.getDefaultValue(); } else { return result; } }
/** * Gets the default value. * * @return the defaultValue */ public Object getDefaultValue() { return param.getDefaultValue(); }
/** * Looks up a parameter, if not found it returns the default value, assuming there is one, or * null otherwise * * @param <T> * @param param * @param params * @param target * @return * @throws IOException */ <T> T lookup(Param param, Map<String, Serializable> params, Class<T> target) throws IOException { T result = (T) param.lookUp(params); if (result == null) { return (T) param.getDefaultValue(); } else { return result; } }