Package org.glassfish.hk2.xml.internal
Class Utilities
java.lang.Object
org.glassfish.hk2.xml.internal.Utilities
- Author:
- jwells
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charSeparator for instance names -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BaseHK2JAXBBean_addRoot(ModelImpl rootNode, Object rawRoot, DynamicChangeInfo<?> changeInfo, ClassReflectionHelper helper, WriteableBeanDatabase writeableDatabase, DynamicConfiguration dynamicService, List<ActiveDescriptor<?>> addedServices, XmlRootHandleImpl<?> xmlRootHandle) Called with write lock heldstatic ActiveDescriptor<?>advertise(WriteableBeanDatabase wbd, DynamicConfiguration config, BaseHK2JAXBBean bean) static voidapplyDiff(Differences differences, DynamicChangeInfo<?> changeControl) Must have write lock of source heldstatic intCalculates and sets the add cost for the given bean and sets all add costs for this bean and all its childrenstatic voidcalculateNamespaces(BaseHK2JAXBBean bean, XmlRootHandleImpl<?> root, Map<String, String> currentValues) static StringconstructXmlTag(String wrapper, String tag) static StringconvertNameToString(Name name) Converts the Name from the Element to a Stringstatic StringconvertToSetter(String getterName) Converts a getter name to a setter name (works with both IS getters and GET getters)static AltClassconvertTypeMirror(TypeMirror typeMirror, ProcessingEnvironment processingEnv) static BaseHK2JAXBBeancreateBean(Class<?> implClass) static StringCreates an instance name by traveling up the parent chain.static <T> BaseHK2JAXBBeandoCopy(BaseHK2JAXBBean copyMe, DynamicChangeInfo<T> copyController, BaseHK2JAXBBean theCopiedParent, XmlRootHandleImpl<?> rootHandle, Map<org.glassfish.hk2.xml.internal.ReferenceKey, BaseHK2JAXBBean> referenceMap, List<UnresolvedReference> unresolved) static voidfillInUnfinishedReferences(Map<org.glassfish.hk2.xml.internal.ReferenceKey, BaseHK2JAXBBean> referenceMap, List<UnresolvedReference> unresolved) static MethodfindSuitableCustomizerMethod(Class<?> cClass, String methodName, Class<?>[] params, Class<?> topInterface) static ObjectReturns the default value given the string version of the default and the expected result (non-child properties)static DifferencesgetDiff(BaseHK2JAXBBean source, BaseHK2JAXBBean other) Must have write lock of source held though this is only doing readingstatic MethodInformationIgetMethodInformation(AltMethod m, NameInformation xmlNameMap) static StringgetProxyNameFromInterfaceName(String iFaceName) Given the fully qualified class name of the interface representing a bean, returns the class name of the proxystatic BaseHK2JAXBBeaninternalAdd(BaseHK2JAXBBean myParent, String childPropertyNamespace, String childProperty, Object rawChild, String childKey, int index, DynamicChangeInfo<?> changeInformation, XmlDynamicChange xmlDynamicChange, List<ActiveDescriptor<?>> addedServices, boolean changeList) static voidinternalModifyChild(BaseHK2JAXBBean myParent, String childPropertyNamespace, String childProperty, Object currentValue, Object newValue, XmlRootHandleImpl<?> root, DynamicChangeInfo<?> changeInformation, XmlDynamicChange xmlDynamicChange) static BaseHK2JAXBBeaninternalRemove(BaseHK2JAXBBean myParent, String childPropertyNamespace, String childProperty, String childKey, int index, Object childToRemove, DynamicChangeInfo<?> changeInformation, XmlDynamicChange xmlDynamicChange, boolean changeList) Write lock must be heldstatic voidinvokeVetoableChangeListeners(DynamicChangeInfo<?> control, BaseHK2JAXBBean source, Object oldValue, Object newValue, String propertyName, ClassReflectionHelper helper) static Stringstatic StringprioritizeMethods(List<AltMethod> methods, String[] specifiedOrdering, NameInformation xmlMap) static StringsafeString(String originalValue)
-
Field Details
-
INSTANCE_PATH_SEPARATOR
public static final char INSTANCE_PATH_SEPARATORSeparator for instance names- See Also:
-
-
Constructor Details
-
Utilities
public Utilities()
-
-
Method Details
-
createBean
-
createInstanceName
Creates an instance name by traveling up the parent chain. The parent chain must therefor already be correctly setup- Parameters:
bean- The non-null bean from where to get the instancename- Returns:
- A unique instance name. The combination of the xml path and the instance name should uniquely identify the location of any node in a single tree
-
advertise
public static ActiveDescriptor<?> advertise(WriteableBeanDatabase wbd, DynamicConfiguration config, BaseHK2JAXBBean bean) -
convertToSetter
Converts a getter name to a setter name (works with both IS getters and GET getters)- Parameters:
getterName- Non-null getter name starting with is or get- Returns:
- The corresponding setter name
-
convertNameToString
Converts the Name from the Element to a String- Parameters:
name-- Returns:
-
convertTypeMirror
public static AltClass convertTypeMirror(TypeMirror typeMirror, ProcessingEnvironment processingEnv) -
internalModifyChild
public static void internalModifyChild(BaseHK2JAXBBean myParent, String childPropertyNamespace, String childProperty, Object currentValue, Object newValue, XmlRootHandleImpl<?> root, DynamicChangeInfo<?> changeInformation, XmlDynamicChange xmlDynamicChange) -
internalAdd
public static BaseHK2JAXBBean internalAdd(BaseHK2JAXBBean myParent, String childPropertyNamespace, String childProperty, Object rawChild, String childKey, int index, DynamicChangeInfo<?> changeInformation, XmlDynamicChange xmlDynamicChange, List<ActiveDescriptor<?>> addedServices, boolean changeList) -
getProxyNameFromInterfaceName
Given the fully qualified class name of the interface representing a bean, returns the class name of the proxy- Parameters:
iFaceName- the never null fully qualified class name of the bean interface- Returns:
- the class name of the proxy
-
_addRoot
public static BaseHK2JAXBBean _addRoot(ModelImpl rootNode, Object rawRoot, DynamicChangeInfo<?> changeInfo, ClassReflectionHelper helper, WriteableBeanDatabase writeableDatabase, DynamicConfiguration dynamicService, List<ActiveDescriptor<?>> addedServices, XmlRootHandleImpl<?> xmlRootHandle) Called with write lock held- Parameters:
rootNode-rawRoot-changeInfo-helper-writeableDatabase-dynamicService-- Returns:
-
internalRemove
public static BaseHK2JAXBBean internalRemove(BaseHK2JAXBBean myParent, String childPropertyNamespace, String childProperty, String childKey, int index, Object childToRemove, DynamicChangeInfo<?> changeInformation, XmlDynamicChange xmlDynamicChange, boolean changeList) Write lock must be held- Parameters:
myParent-childProperty-childKey-index-changeInformation-writeableDatabase-dynamicService-- Returns:
-
getDefaultValue
public static Object getDefaultValue(String givenStringDefault, Class<?> expectedClass, Map<String, String> namespaceMap) Returns the default value given the string version of the default and the expected result (non-child properties)- Parameters:
givenStringDefault-expectedClass-- Returns:
-
fillInUnfinishedReferences
public static void fillInUnfinishedReferences(Map<org.glassfish.hk2.xml.internal.ReferenceKey, BaseHK2JAXBBean> referenceMap, List<UnresolvedReference> unresolved) -
findSuitableCustomizerMethod
-
invokeVetoableChangeListeners
public static void invokeVetoableChangeListeners(DynamicChangeInfo<?> control, BaseHK2JAXBBean source, Object oldValue, Object newValue, String propertyName, ClassReflectionHelper helper) -
getDiff
Must have write lock of source held though this is only doing reading- Parameters:
classReflectionHelper-source-other-- Returns:
-
applyDiff
Must have write lock of source held- Parameters:
classReflectionHelper-source-other-
-
calculateAddCost
Calculates and sets the add cost for the given bean and sets all add costs for this bean and all its children- Parameters:
bean- The bean to calculate and set the add cost on- Returns:
- The add cost, which will be at least one, or -1 if the bean is null
-
prioritizeMethods
-
isSetter
-
isGetter
-
getMethodInformation
-
doCopy
public static <T> BaseHK2JAXBBean doCopy(BaseHK2JAXBBean copyMe, DynamicChangeInfo<T> copyController, BaseHK2JAXBBean theCopiedParent, XmlRootHandleImpl<?> rootHandle, Map<org.glassfish.hk2.xml.internal.ReferenceKey, BaseHK2JAXBBean> referenceMap, List<UnresolvedReference> unresolved) throws Throwable- Throws:
Throwable
-
safeString
-
calculateNamespaces
public static void calculateNamespaces(BaseHK2JAXBBean bean, XmlRootHandleImpl<?> root, Map<String, String> currentValues) -
constructXmlTag
-