クラス NamespaceUtils


  • public abstract class NamespaceUtils
    extends ObjectSE
    名前空間パーサーの共有ユーティリティメソッド。
    作成者:
    Mark Pollack, Dave Syer, Gary Russell
    • コンストラクターの詳細

      • NamespaceUtils

        public NamespaceUtils()
    • メソッドの詳細

      • setValueIfAttributeDefined

        public static boolean setValueIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                         ElementSE element,
                                                         StringSE attributeName,
                                                         StringSE propertyName)
        指定された Bean 定義プロパティに、指定された要素で属性が定義されている場合に、指定された名前の属性の値を取り込みます。
        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - プロパティの入力に使用される値を持つ属性の名前
        propertyName - 設定するプロパティの名前
        戻り値:
        定義されている場合は true。
      • setValueIfAttributeDefined

        public static boolean setValueIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                         ElementSE element,
                                                         StringSE attributeName)
        指定された要素で定義されている場合、指定された attributeName に対応する Bean 定義プロパティにその属性の値を取り込みます。

        プロパティ名は、小文字のハイフンで区切られた属性に相当するキャメルケースの名前になります(たとえば、"foo-bar" 属性は "fooBar" プロパティと一致します)。

        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - プロパティに値が設定される属性の名前
        戻り値:
        定義されている場合は true。
        関連事項:
        Conventions.attributeNameToPropertyName(String)
      • isAttributeDefined

        public static boolean isAttributeDefined​(ElementSE element,
                                                 StringSE attributeName)
        属性をチェックして、指定された要素で定義されているかどうかを確認します。
        パラメーター:
        element - 属性を定義する必要がある XML 要素
        attributeName - 値がコンストラクター引数として使用される属性の名前
        戻り値:
        定義されている場合は true。
      • addConstructorArgValueIfAttributeDefined

        public static boolean addConstructorArgValueIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                                       ElementSE element,
                                                                       StringSE attributeName)
        指定された要素で定義されている場合、Bean 定義コンストラクター引数にその属性の値を入力します。
        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - 値がコンストラクター引数として使用される属性の名前
        戻り値:
        定義されている場合は true。
      • addConstructorArgBooleanValueIfAttributeDefined

        public static void addConstructorArgBooleanValueIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                                           ElementSE element,
                                                                           StringSE attributeName,
                                                                           boolean defaultValue)
        Bean 定義コンストラクター引数に、その属性が指定された要素で定義されている場合、または指定されたデフォルトを使用する場合、その属性のブール値を入力します。
        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - 値がコンストラクター引数として使用される属性の名前
        defaultValue - 属性が設定されていない場合に使用するデフォルト値
      • addConstructorArgRefIfAttributeDefined

        public static boolean addConstructorArgRefIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                                     ElementSE element,
                                                                     StringSE attributeName)
        指定された要素で属性が定義されている場合、属性と等しい id を持つ Bean への参照を使用して、Bean 定義コンストラクター引数を設定します。
        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - 参照を設定するために値が使用される属性の名前
        戻り値:
        定義されている場合は true。
      • addConstructorArgParentRefIfAttributeDefined

        public static boolean addConstructorArgParentRefIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                                           ElementSE element,
                                                                           StringSE attributeName)
        指定された要素で定義されている場合、属性と等しい親 ID を持つ Bean への参照を使用して、Bean 定義コンストラクター引数を設定します。
        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - 参照を設定するために値が使用される属性の名前
        戻り値:
        定義されている場合は true。
      • setReferenceIfAttributeDefined

        public static boolean setReferenceIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                             ElementSE element,
                                                             StringSE attributeName,
                                                             StringSE propertyName)
        指定された Bean 定義プロパティに Bean への参照を設定します。Bean 参照は、その属性が特定の要素で定義されている場合、その名前が提供されている属性の値によって識別されます。
        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - プロパティを設定するための Bean 参照として使用される値を持つ属性の名前
        propertyName - 設定するプロパティの名前
        戻り値:
        属性が存在し、テキストがある場合は true
      • setReferenceIfAttributeDefined

        public static boolean setReferenceIfAttributeDefined​(BeanDefinitionBuilder builder,
                                                             ElementSE element,
                                                             StringSE attributeName)
        指定された要素で属性が定義されている場合、その属性の値によって識別される Bean への参照を使用して、指定された attributeName に対応する Bean 定義プロパティを設定します。

        プロパティ名は、小文字のハイフンで区切られた属性に相当するキャメルケースの名前になります(たとえば、"foo-bar" 属性は "fooBar" プロパティと一致します)。

        パラメーター:
        builder - 構成する Bean 定義ビルダー
        element - 属性を定義する必要がある XML 要素
        attributeName - プロパティを設定するための Bean 参照として使用される値を持つ属性の名前
        戻り値:
        定義されている場合は true。
        関連事項:
        Conventions.attributeNameToPropertyName(String)
      • createElementDescription

        public static StringSE createElementDescription​(ElementSE element)
        ノード名に基づいて要素のわかりやすい説明を提供します。使用可能な場合は、"id" 属性値も提供します。これは、Bean 定義パーサー内からエラーメッセージを作成できます。
        パラメーター:
        element - 要素。
        戻り値:
        説明。
      • parseDeclarationControls

        public static void parseDeclarationControls​(ElementSE element,
                                                    BeanDefinitionBuilder builder)
        "auto-declare" および "declared-by" 属性を解析します。
        パラメーター:
        element - 要素。
        builder - ビルダー。
      • createExpressionDefinitionFromValueOrExpression

        public static BeanDefinition createExpressionDefinitionFromValueOrExpression​(StringSE valueElementName,
                                                                                     StringSE expressionElementName,
                                                                                     ParserContext parserContext,
                                                                                     ElementSE element,
                                                                                     boolean oneRequired)
      • createExpressionDefIfAttributeDefined

        public static BeanDefinition createExpressionDefIfAttributeDefined​(StringSE expressionElementName,
                                                                           ElementSE element)