Skip to content

Commit

Permalink
Add some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Nov 18, 2015
1 parent ebdb228 commit 7f54c2a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*/
package net.sf.jabref.model.entry;

import net.sf.jabref.model.database.BibtexDatabase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -52,11 +50,6 @@ public BibLatexEntryType() {
requiredFields.add("bibtexkey");
}

@Override
public EntryTypes getEntryType() {
return EntryTypes.BIBLATEX;
}

@Override
public List<String> getOptionalFields() {
return Collections.unmodifiableList(optionalFields);
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/net/sf/jabref/model/entry/BibtexEntryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*/
package net.sf.jabref.model.entry;

import net.sf.jabref.model.database.BibtexDatabase;

import java.util.*;
import java.util.stream.Collectors;

Expand All @@ -46,11 +44,6 @@ public BibtexEntryType() {
optionalFields = new ArrayList<>();
}

@Override
public EntryTypes getEntryType() {
return EntryTypes.BIBTEX;
}

@Override
public List<String> getOptionalFields() {
return Collections.unmodifiableList(optionalFields);
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/net/sf/jabref/model/entry/CustomEntryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
*/
package net.sf.jabref.model.entry;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import net.sf.jabref.model.database.BibtexDatabase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Expand Down Expand Up @@ -71,11 +67,6 @@ public CustomEntryType(String name, String required, String optional) {
}
}

@Override
public EntryTypes getEntryType() {
return EntryTypes.BIBTEX;
}

@Override
public int compareTo(EntryType o) {
return getName().compareTo(o.getName());
Expand Down
25 changes: 23 additions & 2 deletions src/main/java/net/sf/jabref/model/entry/EntryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,35 @@
* Interface for all EntryTypes.
*/
public interface EntryType extends Comparable<EntryType> {
/**
* Returns the tag name of the entry type.
*
* @return tag name of the entry type.
*/
String getName();

/**
* Returns all supported optional field names.
*
* @return a List of optional field name Strings
*/
List<String> getOptionalFields();

/**
* Returns all required field names.
* If fields have an OR relationship the name includes both field names divided by /, e.g. author/editor.
* If you need all required fields as sole entities use @see{getRequiredFieldsFlat} .
*
* @return a List of required field name Strings
*/
List<String> getRequiredFields();

/**
* Returns all required field names.
* No OR relationships are captured here.
*
* @return a List of required field name Strings
*/
default List<String> getRequiredFieldsFlat() {
List<String> requiredFlat = getRequiredFields().stream()
.map(field -> field.split("/"))
Expand All @@ -26,8 +49,6 @@ default List<String> getRequiredFieldsFlat() {
return Collections.unmodifiableList(requiredFlat);
}

EntryTypes getEntryType();

/**
* TODO: move inside GUI
*/
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/net/sf/jabref/model/entry/UnknownEntryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package net.sf.jabref.model.entry;

import net.sf.jabref.model.database.BibtexDatabase;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -49,11 +47,6 @@ public String getName() {
return name;
}

@Override
public EntryTypes getEntryType() {
return EntryTypes.UNKNOWN;
}

@Override
public List<String> getOptionalFields() {
return Collections.unmodifiableList(optionalFields);
Expand Down

0 comments on commit 7f54c2a

Please sign in to comment.