Search in sources :

Example 1 with OverrideOnDemand

use of com.helger.commons.annotation.OverrideOnDemand in project ph-schematron by phax.

the class PSBoundSchemaCacheKey method createPreprocessedSchema.

/**
 * Pre-process the read schema, using the determined query binding.
 *
 * @param aSchema
 *        The read schema. Never <code>null</code>.
 * @param aQueryBinding
 *        The determined query binding. Never <code>null</code>.
 * @return The pre-processed schema and never <code>null</code>.
 * @throws SchematronException
 *         In case pre-processing fails
 */
@Nonnull
@OverrideOnDemand
public PSSchema createPreprocessedSchema(@Nonnull final PSSchema aSchema, @Nonnull final IPSQueryBinding aQueryBinding) throws SchematronException {
    final PSPreprocessor aPreprocessor = createPreprocessor(aQueryBinding);
    final PSSchema aPreprocessedSchema = aPreprocessor.getAsPreprocessedSchema(aSchema);
    if (aPreprocessedSchema == null)
        throw new SchematronPreprocessException("Failed to preprocess schema " + aSchema + " with query binding " + aQueryBinding);
    if (SchematronDebug.isShowPreprocessedSchematron())
        s_aLogger.info("Preprocessed Schematron:\n" + MicroWriter.getNodeAsString(aPreprocessedSchema.getAsMicroElement()));
    return aPreprocessedSchema;
}
Also used : SchematronPreprocessException(com.helger.schematron.pure.preprocess.SchematronPreprocessException) PSPreprocessor(com.helger.schematron.pure.preprocess.PSPreprocessor) PSSchema(com.helger.schematron.pure.model.PSSchema) Nonnull(javax.annotation.Nonnull) OverrideOnDemand(com.helger.commons.annotation.OverrideOnDemand)

Example 2 with OverrideOnDemand

use of com.helger.commons.annotation.OverrideOnDemand in project ph-schematron by phax.

the class PSWriter method getAsDocument.

@Nonnull
@OverrideOnDemand
protected IMicroNode getAsDocument(@Nonnull final IMicroElement aElement) {
    final IMicroDocument aDoc = new MicroDocument();
    aDoc.appendChild(aElement);
    return aDoc;
}
Also used : IMicroDocument(com.helger.xml.microdom.IMicroDocument) MicroDocument(com.helger.xml.microdom.MicroDocument) IMicroDocument(com.helger.xml.microdom.IMicroDocument) Nonnull(javax.annotation.Nonnull) OverrideOnDemand(com.helger.commons.annotation.OverrideOnDemand)

Example 3 with OverrideOnDemand

use of com.helger.commons.annotation.OverrideOnDemand in project ph-css by phax.

the class CSSShortHandDescriptorWithAlignment method modifyExpressionMembers.

@Override
@OverrideOnDemand
protected void modifyExpressionMembers(@Nonnull final ICommonsList<ICSSExpressionMember> aExpressionMembers) {
    final int nSize = aExpressionMembers.size();
    if (nSize == 1) {
        // 4px -> 4px 4px 4px 4px
        final ICSSExpressionMember aMember = aExpressionMembers.getFirst();
        for (int i = 0; i < 3; ++i) aExpressionMembers.add(aMember.getClone());
    } else if (nSize == 2) {
        // 4px 10px -> 4px 10px 4px 10px
        final ICSSExpressionMember aMemberY = aExpressionMembers.get(0);
        final ICSSExpressionMember aMemberX = aExpressionMembers.get(1);
        aExpressionMembers.add(aMemberY.getClone());
        aExpressionMembers.add(aMemberX.getClone());
    } else if (nSize == 3) {
        // 4px 10px 6px -> 4px 10px 6px 10px
        final ICSSExpressionMember aMemberX = aExpressionMembers.get(1);
        aExpressionMembers.add(aMemberX.getClone());
    }
// else nothing to do
}
Also used : ICSSExpressionMember(com.helger.css.decl.ICSSExpressionMember) OverrideOnDemand(com.helger.commons.annotation.OverrideOnDemand)

Aggregations

OverrideOnDemand (com.helger.commons.annotation.OverrideOnDemand)3 Nonnull (javax.annotation.Nonnull)2 ICSSExpressionMember (com.helger.css.decl.ICSSExpressionMember)1 PSSchema (com.helger.schematron.pure.model.PSSchema)1 PSPreprocessor (com.helger.schematron.pure.preprocess.PSPreprocessor)1 SchematronPreprocessException (com.helger.schematron.pure.preprocess.SchematronPreprocessException)1 IMicroDocument (com.helger.xml.microdom.IMicroDocument)1 MicroDocument (com.helger.xml.microdom.MicroDocument)1