|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectezvcard.io.scribe.ScribeIndex
public class ScribeIndex
Manages a listing of property scribes (marshallers). This is useful for injecting the scribes of any extended properties you have defined into a reader or writer object. The same object instance can be reused and injected into multiple reader/writer classes.
Example:
//init the index
ScribeIndex index = new ScribeIndex();
index.register(new CustomPropertyScribe());
index.register(new AnotherCustomPropertyScribe());
//inject into a reader class
VCardReader vcardReader = new VCardReader(...);
vcardReader.setScribeIndex(index);
List<VCard> vcards = new ArrayList<VCard>();
VCard vcards;
while ((vcards = vcardReader.readNext()) != null){
vcards.add(vcard);
}
//inject the same instance in another reader/writer class
JCardWriter jcardWriter = new JCardWriter(...);
jcardWriter.setScribeIndex(index);
for (VCard vcard : vcards){
jcardWriter.write(vcard);
}
jcardWriter.close();
| Constructor Summary | |
|---|---|
ScribeIndex()
|
|
| Method Summary | |
|---|---|
VCardPropertyScribe<? extends VCardProperty> |
getPropertyScribe(Class<? extends VCardProperty> clazz)
Gets a property scribe by class. |
VCardPropertyScribe<? extends VCardProperty> |
getPropertyScribe(QName qname)
Gets a property scribe by XML local name and namespace. |
VCardPropertyScribe<? extends VCardProperty> |
getPropertyScribe(String propertyName)
Gets a property scribe by name. |
VCardPropertyScribe<? extends VCardProperty> |
getPropertyScribe(VCardProperty property)
Gets the appropriate property scribe for a given property instance. |
void |
register(VCardPropertyScribe<? extends VCardProperty> scribe)
Registers a property scribe. |
void |
unregister(VCardPropertyScribe<? extends VCardProperty> scribe)
Unregisters a property scribe. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScribeIndex()
| Method Detail |
|---|
public VCardPropertyScribe<? extends VCardProperty> getPropertyScribe(String propertyName)
propertyName - the property name (case-insensitive, e.g. "FN")
public VCardPropertyScribe<? extends VCardProperty> getPropertyScribe(Class<? extends VCardProperty> clazz)
clazz - the property class
public VCardPropertyScribe<? extends VCardProperty> getPropertyScribe(VCardProperty property)
property - the property instance
public VCardPropertyScribe<? extends VCardProperty> getPropertyScribe(QName qname)
qname - the XML local name and namespace
XmlScribe if not foundpublic void register(VCardPropertyScribe<? extends VCardProperty> scribe)
scribe - the scribe to registerpublic void unregister(VCardPropertyScribe<? extends VCardProperty> scribe)
scribe - the scribe to unregister
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||