11package com .flagsmith .offline ;
22
3- import com .fasterxml .jackson .databind .JsonNode ;
43import com .fasterxml .jackson .databind .ObjectMapper ;
54import com .flagsmith .MapperFactory ;
65import com .flagsmith .exceptions .FlagsmithClientError ;
7- import com .flagsmith .flagengine .EvaluationContext ;
86import com .flagsmith .interfaces .IOfflineHandler ;
9- import com .flagsmith .mappers . EngineMappers ;
7+ import com .flagsmith .models . environments . EnvironmentModel ;
108import java .io .File ;
119import java .io .IOException ;
1210
1311public class LocalFileHandler implements IOfflineHandler {
14- private EvaluationContext evaluationContext ;
12+ private EnvironmentModel environmentModel ;
1513 private ObjectMapper objectMapper = MapperFactory .getMapper ();
1614
1715 /**
@@ -22,14 +20,13 @@ public class LocalFileHandler implements IOfflineHandler {
2220 public LocalFileHandler (String filePath ) throws FlagsmithClientError {
2321 File file = new File (filePath );
2422 try {
25- JsonNode environmentDocument = objectMapper .readValue (file , JsonNode .class );
26- this .evaluationContext = EngineMappers .mapEnvironmentDocumentToContext (environmentDocument );
23+ this .environmentModel = objectMapper .readValue (file , EnvironmentModel .class );
2724 } catch (IOException e ) {
2825 throw new FlagsmithClientError ("Unable to read environment from file " + filePath );
2926 }
3027 }
3128
32- public EvaluationContext getEvaluationContext () {
33- return evaluationContext ;
29+ public EnvironmentModel getEnvironment () {
30+ return environmentModel ;
3431 }
3532}
0 commit comments