Class SunCmpMappingsUtils
- java.lang.Object
-
- com.sun.jdo.api.persistence.mapping.ejb.SunCmpMappingsUtils
-
public class SunCmpMappingsUtils extends Object
Finder utilities for elements of the SunCmpMappings object graph.- Author:
- vkraemer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CmpFieldMapping
findCmpFieldMapping(EntityMapping em, String fname, boolean addEmpty)
Find the CmpFieldMapping element with a matching field-name element valuestatic CmrFieldMapping
findCmrFieldMapping(EntityMapping em, String fname, boolean addEmpty)
Find the cmr-field-mapping element for a field in an EntityMapping objectprotected static List<?>
findCompatibleBeansWithValue(org.netbeans.modules.schema2beans.BaseBean root, String propName, String propVal, Class<?> type)
A utility for finding beans in a graph of BaseBean objects.static EntityMapping
findEntityMapping(SunCmpMappings scms, String bname, boolean addEmpty)
Find the EntityMapping element that correspond to a bean.static SunCmpMapping
getFirstSunCmpMapping(SunCmpMappings scms, boolean addEmpty)
Return the first SunCmpMapping element from the graph.
-
-
-
Method Detail
-
getFirstSunCmpMapping
public static SunCmpMapping getFirstSunCmpMapping(SunCmpMappings scms, boolean addEmpty)
Return the first SunCmpMapping element from the graph.- Parameters:
scms
- The root of a SunCmpMappings object graphaddEmpty
- flag to add an empty version of the SunCmpMapping element to the graph if one is not found.- Returns:
- The first SunCmpMapping element in the graph or null if it doesn't exists and addEmpty is false.
-
findEntityMapping
public static EntityMapping findEntityMapping(SunCmpMappings scms, String bname, boolean addEmpty) throws IllegalArgumentException
Find the EntityMapping element that correspond to a bean.- Parameters:
scms
- the root of the SunCmpMappings graphbname
- The value of the ejb-name element for a bean in the graphaddEmpty
- flag to add an empty version of the EntityMapping element to the graph if one is not found.- Returns:
- the EntityMapping element, or null if addEmpty is false and the EntityMapping is not found.
- Throws:
IllegalArgumentException
- if more than one EntityMapping element has an ejb-name element with the matching value
-
findCmrFieldMapping
public static CmrFieldMapping findCmrFieldMapping(EntityMapping em, String fname, boolean addEmpty) throws IllegalArgumentException
Find the cmr-field-mapping element for a field in an EntityMapping object- Parameters:
em
- The root of the searchfname
- the name of the fieldaddEmpty
- flag to add an empty version of the CmrFieldMapping element to the graph if one is not found.- Returns:
- the CmrFieldMapping element or null if addEmpty is false and the field is not found.
- Throws:
IllegalArgumentException
- If there is more than one cmr-field with a matching cmr-field-name element in the EntityMapping graph.
-
findCmpFieldMapping
public static CmpFieldMapping findCmpFieldMapping(EntityMapping em, String fname, boolean addEmpty) throws IllegalArgumentException
Find the CmpFieldMapping element with a matching field-name element value- Parameters:
em
- the root of the searchfname
- the value of the field-name elementaddEmpty
- flag to add an empty version of the CmpFieldMapping element to the graph if one is not found.- Returns:
- The CmpFieldMapping element or null if addEmpty is false and the field is not found.
- Throws:
IllegalArgumentException
- If there is more than one cmp-field with a matching field-name element in the EntityMapping graph.
-
findCompatibleBeansWithValue
protected static List<?> findCompatibleBeansWithValue(org.netbeans.modules.schema2beans.BaseBean root, String propName, String propVal, Class<?> type) throws IllegalArgumentException
A utility for finding beans in a graph of BaseBean objects. Search the bean graph, starting at a given root, for beans where the named property has the given value. The returned list is filtered by assignment compatibility.- Parameters:
root
- The root of a searchpropName
- The name of the elementpropVal
- the value of the elementtype
- The expected type of the value to be returned.- Returns:
- The assignment compatible BaseBeans that were found.
- Throws:
IllegalArgumentException
- If the bean is not part of a complete bean graph.
-
-