|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.schemarepo.RepositoryUtil
public final class RepositoryUtil
RepositoryUtil contains static helper methods for the
org.schemarepo package.
subjectsToString(Iterable) and
subjectNamesFromString(String) can be used to encode
subjects to string format.
schemasToString(Iterable) and schemasFromString(String) can
be used to encode schemas to string format.
These formats simply delimit items by the newline character and can be used for human readable output. The RESTRepository uses this format to encode subjects and schemas over HTTP. Subject names are forbidden from containing whitespace. Schemas have their whitespace removed prior to use in the Repository.
| Method Summary | |
|---|---|
static String |
commaJoin(Collection<String> strings)
|
static List<String> |
commaSplit(String toSplit)
Helper method for splitting a string by a delimiter with java.util.String.split(). |
static SubjectConfig |
configFromProperties(Properties props)
Returns an immutable Map |
static String |
propertiesToString(Properties props,
String comment)
Converts properties to string representation |
static SubjectConfig |
safeConfig(SubjectConfig config)
temporary until we have decided how to deal with null configs or create a SubjectConfig class |
static Iterable<SchemaEntry> |
schemasFromString(String str)
Decode a string created by schemasToString(Iterable) |
static String |
schemasToString(Iterable<SchemaEntry> allEntries)
Encode SchemaEntry objects into a String for use by
schemasFromString(String) |
static Iterable<String> |
subjectNamesFromString(String str)
Decode a string created by subjectsToString(Iterable) |
static String |
subjectsToString(Iterable<Subject> subjects)
Encode Subjects into a String for use by
subjectNamesFromString(String) |
static void |
validateSchemaOrSubject(String val)
Throws IllegalArgumentException if the string provided is null, or empty. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String subjectsToString(Iterable<Subject> subjects)
Subjects into a String for use by
subjectNamesFromString(String)
subjects - the Subject objects to encode
Subject objects encoded as a Stringpublic static Iterable<String> subjectNamesFromString(String str)
subjectsToString(Iterable)
str - The String to decode
Iterable of Subjectpublic static String schemasToString(Iterable<SchemaEntry> allEntries)
SchemaEntry objects into a String for use by
schemasFromString(String)
allEntries - the SchemaEntry objects to encode
SchemaEntry objects encoded as a Stringpublic static Iterable<SchemaEntry> schemasFromString(String str)
schemasToString(Iterable)
str - The String to decode
Iterable of SchemaEntrypublic static void validateSchemaOrSubject(String val)
public static SubjectConfig configFromProperties(Properties props)
public static SubjectConfig safeConfig(SubjectConfig config)
public static List<String> commaSplit(String toSplit)
toSplit - The string to split. If null, an empty
String[] is returned
public static String commaJoin(Collection<String> strings)
public static String propertiesToString(Properties props,
String comment)
props - comment - optional comment (can be null)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||