Package org.apache.sling.feature.maven
Class JSONFeatures
java.lang.Object
org.apache.sling.feature.maven.JSONFeatures
public class JSONFeatures extends Object
-
Field Summary
Fields Modifier and Type Field Description static org.apache.sling.feature.ArtifactIdPLACEHOLDER_ID -
Constructor Summary
Constructors Constructor Description JSONFeatures() -
Method Summary
Modifier and Type Method Description static voidhandleDefaultMetadata(org.apache.sling.feature.Feature feature, Map<String,Map<String,String>> defaultMetadata)static voidhandleExtensions(org.apache.sling.feature.Feature feature, File file)Check for extensions of type text and if they reference a file.static Stringread(Reader reader, org.apache.sling.feature.ArtifactId optionalId, String location)Read the feature and add theidattribute if missingstatic voidwrite(Writer writer, org.apache.sling.feature.Feature feature)Write the feature.
-
Field Details
-
PLACEHOLDER_ID
public static final org.apache.sling.feature.ArtifactId PLACEHOLDER_ID
-
-
Constructor Details
-
JSONFeatures
public JSONFeatures()
-
-
Method Details
-
read
public static String read(Reader reader, org.apache.sling.feature.ArtifactId optionalId, String location) throws IOExceptionRead the feature and add theidattribute if missing- Parameters:
reader- The readeroptionalId- The artifact id to use if theidattribute is missinglocation- The location- Returns:
- The feature as a string
- Throws:
IOException- If reading fails
-
write
public static void write(Writer writer, org.apache.sling.feature.Feature feature) throws IOExceptionWrite the feature. If the id is thePLACEHOLDER_IDthen the id is not written out- Parameters:
writer- The writerfeature- The feature- Throws:
IOException- If anything goes wrong
-
handleExtensions
public static void handleExtensions(org.apache.sling.feature.Feature feature, File file) throws IOExceptionCheck for extensions of type text and if they reference a file.- Parameters:
feature- The feature to checkfile- The file to check for- Throws:
IOException- when an IO Exception occurs
-
handleDefaultMetadata
-