Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / gvsig_2_3_0 / featuretype.py @ 462

History | View | Annotate | Download (816 Bytes)

1

    
2

    
3
from org.gvsig.fmap.dal.feature.impl import DefaultFeatureType as JFeatureType
4

    
5

    
6
def _getitem(self, name):
7
  return self.getAttributeDescriptor(name)
8

    
9
def _iter(self):
10
  return iter(self.getAttributeDescriptors())
11
  
12
def _len(self):
13
  return len(self.getAttributeDescriptors())
14
  
15

    
16
def _get(self, name, default=None):
17
  x = self.getAttributeDescriptor(name)
18
  if x == None:
19
    return default
20
  return x
21

    
22
def _getAttrNames(self):
23
  if not self.getAttributeDescriptors():
24
    return None
25
      
26
  return [attr.getName() for attr in self.getAttributeDescriptors()]
27
  
28
def _call(self):
29
  return self    
30
    
31

    
32
#
33
# Inject new methods in the class JFeatureType
34
#
35
JFeatureType.__call__ = _call
36
JFeatureType.__iter__ = _iter
37
JFeatureType.__len__ = _len
38
JFeatureType.get = _get
39
JFeatureType.getAttrNames = _getAttrNames
40

    
41