move type models to io package
This commit is contained in:
parent
a3ceb736d4
commit
0f86c8dae7
@ -15,7 +15,7 @@ import de.marhali.easyi18n.InstanceManager;
|
||||
import de.marhali.easyi18n.io.ArrayMapper;
|
||||
import de.marhali.easyi18n.model.FolderStrategyType;
|
||||
import de.marhali.easyi18n.model.SettingsState;
|
||||
import de.marhali.easyi18n.model.ParserStrategyType;
|
||||
import de.marhali.easyi18n.ionext.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.service.SettingsService;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -3,7 +3,7 @@ package de.marhali.easyi18n.ionext.folder;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import de.marhali.easyi18n.model.ParserStrategyType;
|
||||
import de.marhali.easyi18n.ionext.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.model.SettingsState;
|
||||
import de.marhali.easyi18n.model.TranslationData;
|
||||
import de.marhali.easyi18n.model.TranslationFile;
|
||||
|
@ -2,7 +2,7 @@ package de.marhali.easyi18n.ionext.folder;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import de.marhali.easyi18n.model.ParserStrategyType;
|
||||
import de.marhali.easyi18n.ionext.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.model.SettingsState;
|
||||
import de.marhali.easyi18n.model.TranslationData;
|
||||
import de.marhali.easyi18n.model.TranslationFile;
|
||||
|
@ -2,7 +2,7 @@ package de.marhali.easyi18n.ionext.folder;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import de.marhali.easyi18n.model.ParserStrategyType;
|
||||
import de.marhali.easyi18n.ionext.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.model.SettingsState;
|
||||
import de.marhali.easyi18n.model.TranslationData;
|
||||
import de.marhali.easyi18n.model.TranslationFile;
|
||||
|
@ -2,7 +2,7 @@ package de.marhali.easyi18n.ionext.folder;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import de.marhali.easyi18n.model.ParserStrategyType;
|
||||
import de.marhali.easyi18n.ionext.parser.ParserStrategyType;
|
||||
import de.marhali.easyi18n.model.SettingsState;
|
||||
import de.marhali.easyi18n.model.TranslationData;
|
||||
import de.marhali.easyi18n.model.TranslationFile;
|
||||
|
@ -0,0 +1,53 @@
|
||||
package de.marhali.easyi18n.ionext.parser;
|
||||
|
||||
import de.marhali.easyi18n.ionext.parser.json.JsonParserStrategy;
|
||||
import de.marhali.easyi18n.ionext.parser.properties.PropertiesParserStrategy;
|
||||
import de.marhali.easyi18n.ionext.parser.yaml.YamlParserStrategy;
|
||||
|
||||
/**
|
||||
* Represents all supported file parser strategies.
|
||||
* @author marhali
|
||||
*/
|
||||
public enum ParserStrategyType {
|
||||
JSON(JsonParserStrategy.class),
|
||||
YAML(YamlParserStrategy.class),
|
||||
YML(YamlParserStrategy.class),
|
||||
PROPERTIES(PropertiesParserStrategy.class),
|
||||
ARB(JsonParserStrategy.class);
|
||||
|
||||
private final Class<? extends ParserStrategy> strategy;
|
||||
|
||||
ParserStrategyType(Class<? extends ParserStrategy> strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public Class<? extends ParserStrategy> getStrategy() {
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public String getFileExtension() {
|
||||
return toString().toLowerCase();
|
||||
}
|
||||
|
||||
public String getExampleFilePattern() {
|
||||
return "*." + this.getFileExtension();
|
||||
}
|
||||
|
||||
public int toIndex() {
|
||||
int index = 0;
|
||||
|
||||
for(ParserStrategyType strategy : values()) {
|
||||
if(strategy == this) {
|
||||
return index;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public static ParserStrategyType fromIndex(int index) {
|
||||
return values()[index];
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package de.marhali.easyi18n.model;
|
||||
|
||||
/**
|
||||
* Represents all supported file parser strategies.
|
||||
* @author marhali
|
||||
*/
|
||||
public enum ParserStrategyType {
|
||||
JSON,
|
||||
YAML,
|
||||
PROPERTIES;
|
||||
|
||||
public String getExampleFilePattern() {
|
||||
return "*." + toString().toLowerCase();
|
||||
}
|
||||
|
||||
public int toIndex() {
|
||||
int index = 0;
|
||||
|
||||
for(ParserStrategyType strategy : values()) {
|
||||
if(strategy == this) {
|
||||
return index;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public static ParserStrategyType fromIndex(int index) {
|
||||
return values()[index];
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package de.marhali.easyi18n.model;
|
||||
|
||||
import de.marhali.easyi18n.ionext.parser.ParserStrategyType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user