Returns a scanner instance appropriate to 'type' and 'property_set'.
177775
def get_scanner (type, prop_set):
    
    if __debug__:
        from .property_set import PropertySet
        assert isinstance(type, basestring)
        assert isinstance(prop_set, PropertySet)
    if registered (type):
        scanner_type = __types [type]['scanner']
        if scanner_type:
            return scanner.get (scanner_type, prop_set.raw ())
            pass

    return None
195644
private static Map<String, String> getIntrospectedProperties(String clz, URLClassLoader cl, PrintStream error)
   {
      Map<String, String> result = null;

      try
      {
         Class<?> c = Class.forName(clz, true, cl);

         result = new TreeMap<String, String>();

         Method[] methods = c.getMethods();

         for (Method m : methods)
         {
            if (m.getName().startsWith("set") && m.getParameterTypes().length == 1
                  && isValidType(m.getParameterTypes()[0]))
            {
               String name = m.getName().substring(3);

               if (name.length() == 1)
               {
                  name = name.toLowerCase(Locale.US);
               }
               else
               {
                  name = name.substring(0, 1).toLowerCase(Locale.US) + name.substring(1);
               }

               String type = m.getParameterTypes()[0].getName();

               result.put(name, type);
            }
         }
      }
      catch (Throwable t)
      {
         // Nothing we can do
         t.printStackTrace(error);
      }
      return result;
   }
1067699
public Pair<Boolean, String> property() {
    String name = method.getName();
    if (Modifier.isStatic(method.getModifiers())) return null;
    if (0 == parameterTypes.length) {
      if (name.startsWith("get")) {
        if (name.length() > 3) return of(TRUE, uncapitalize(substringAfter(name, "get")));
      } else if (name.startsWith("is")) {
        if (name.length() > 2) return of(TRUE, uncapitalize(substringAfter(name, "is")));
      }
    } else if (1 == parameterTypes.length) {
      if (name.startsWith("set") && name.length() > 3) return of(FALSE,
          uncapitalize(substringAfter(name, "set")));
    }
    return null;
  }
1352716
private static BeanProperty[][] getBeanProperties(Class beanType, PropertySet set) {
        List readProperties = new ArrayList();
        List writeProperties = new ArrayList();

        Map map = BeanIntrospector.getAllProperties(beanType);

        Iterator it = map.values().iterator();
        while (it.hasNext()) {
            BeanProperty bp = (BeanProperty)it.next();

            if (set == PropertySet.READ_WRITE ||
                set == PropertySet.READ_WRITE_UNCHECKED_EXCEPTIONS)
            {
                if (bp.getReadMethod() == null || bp.getWriteMethod() == null) {
                    continue;
                }
            }
 
            boolean checkedAllowed = 
                set != PropertySet.UNCHECKED_EXCEPTIONS &&
                set != PropertySet.READ_WRITE_UNCHECKED_EXCEPTIONS;

            if (bp.getReadMethod() != null) {
                if (checkedAllowed || !throwsCheckedException(bp.getReadMethod())) {
                    readProperties.add(bp);
                }
            }
            if (bp.getWriteMethod() != null) {
                if (checkedAllowed || !throwsCheckedException(bp.getWriteMethod())) {
                    writeProperties.add(bp);
                }
            }
        }

        BeanProperty[][] props = new BeanProperty[2][];
        
        props[0] = new BeanProperty[readProperties.size()];
        readProperties.toArray(props[0]);
        props[1] = new BeanProperty[writeProperties.size()];
        writeProperties.toArray(props[1]);

        return props;
    }
990772
public <T extends Annotation> T getPropertySet(Class<T> propertySet)
    {
        if (!containsPropertySet(propertySet))
            return null;

        return PropertySetProxy.getProxy(propertySet, this);
    }
161368
def _tp__get_typed_properties(self):
        
        try:
            return tuple(getattr(self, p) for p in self._tp__typed_properties)
        except AttributeError:
            raise NotImplementedError
610115
private TypePair getPropertyType(Object bean, String name) throws IllegalAccessException, InvocationTargetException {
        try {
            PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(bean, name);
            if(propDescriptor!=null) {
                Method m = propDescriptor.getWriteMethod();
                if(m!=null)
                    return new TypePair(m.getGenericParameterTypes()[0], m.getParameterTypes()[0]);
            }
        } catch (NoSuchMethodException e) {
            // no such property
        }

        // try a field
        try {
            return new TypePair(bean.getClass().getField(name));
        } catch (NoSuchFieldException e) {
            // no such field
        }

        return null;
    }
261967
def to_set_field(cls):
    
    class SetConverter(object):

        def __init__(self, cls):
            self._cls = cls

        @property
        def cls(self):
            return resolve_class(self._cls)

        def __call__(self, values):
            values = values or set()
            args = {to_model(self.cls, value) for value in values}
            return TypedSet(cls=self.cls, args=args)

    return SetConverter(cls)
1276433
private CodeBlock getDefaultValue(Property prop, FieldSpec field) {
    if (field.type.isPrimitive()) {
      String defaultValue = getDefaultPrimitiveValue(field.type);
      if (defaultValue != null) {
        return CodeBlock.of("$L", defaultValue);
      } else {
        return CodeBlock.of("$T.valueOf(null)", field.type);
      }
    }
    if (prop.nullable()) {
      return null;
    }
    TypeMirror type = prop.element.getReturnType();
    if (type.getKind() != TypeKind.DECLARED) {
      return null;
    }
    TypeElement typeElement = MoreTypes.asTypeElement(type);
    if (typeElement == null) {
      return null;
    }

    return null;
  }
785729
public static ExecutableElement findSetterMethod(
      String propertyName, TypeMirror type, TypeElement declaringClass, boolean isStatic) {
    ExecutableElement setter = ElementUtil.findMethod(
        declaringClass,
        "set" + NameTable.capitalize(propertyName),
        TypeUtil.getQualifiedName(type));
    return setter != null && isStatic == isStatic(setter) ? setter : null;
  }
186023
def _scan(self, type):
        
        tok = self._scanner.token(self._pos, frozenset([type]))
        if tok[2] != type:
            err = SyntaxError("SyntaxError[@ char %s: %s]" % (repr(tok[0]), "Trying to find " + type))
            err.pos = tok[0]
            raise err
        self._pos += 1
        return tok[3]
1063767
private static IndexedTypeSet toRootEntities(ExtendedSearchIntegrator extendedIntegrator, Class<?>... selection) {
		Set<Class<?>> entities = new HashSet<Class<?>>();
		//first build the "entities" set containing all indexed subtypes of "selection".
		for ( Class<?> entityType : selection ) {
			IndexedTypeSet targetedClasses = extendedIntegrator.getIndexedTypesPolymorphic( IndexedTypeSets.fromClass( entityType ) );
			if ( targetedClasses.isEmpty() ) {
				String msg = entityType.getName() + " is not an indexed entity or a subclass of an indexed entity";
				throw new IllegalArgumentException( msg );
			}
			entities.addAll( targetedClasses.toPojosSet() );
		}
		Set<Class<?>> cleaned = new HashSet<Class<?>>();
		Set<Class<?>> toRemove = new HashSet<Class<?>>();
		//now remove all repeated types to avoid duplicate loading by polymorphic query loading
		for ( Class<?> type : entities ) {
			boolean typeIsOk = true;
			for ( Class<?> existing : cleaned ) {
				if ( existing.isAssignableFrom( type ) ) {
					typeIsOk = false;
					break;
				}
				if ( type.isAssignableFrom( existing ) ) {
					toRemove.add( existing );
				}
			}
			if ( typeIsOk ) {
				cleaned.add( type );
			}
		}
		cleaned.removeAll( toRemove );
		log.debugf( "Targets for indexing job: %s", cleaned );
		return IndexedTypeSets.fromClasses( cleaned.toArray( new Class[cleaned.size()] ) );
	}
952134
def set_scanner (type, scanner):
    
    if __debug__:
        from .scanner import Scanner
        assert isinstance(type, basestring)
        assert issubclass(scanner, Scanner)
    validate (type)
    __types [type]['scanner'] = scanner
1062636
private static PropertyDescriptor getPropertyDescriptor( final Class<?> type, final String propertyName ) {

        Exceptions.requireNonNull(type);
        Exceptions.requireNonNull(propertyName);

        if ( !propertyName.contains( "." ) ) {
            return doGetPropertyDescriptor( type, propertyName );
        } else {
            String[] propertyNames = propertyName.split( "[.]" );
            Class<?> clazz = type;
            PropertyDescriptor propertyDescriptor = null;
            for ( String pName : propertyNames ) {
                propertyDescriptor = doGetPropertyDescriptor( clazz, pName );
                if ( propertyDescriptor == null ) {
                    return null;
                }
                clazz = propertyDescriptor.getPropertyType();
            }
            return propertyDescriptor;
        }
    }
875880
def _property_search(self, fobj):
        """"""
        # Get class object
        scontext = fobj.f_locals.get("self", None)
        class_obj = scontext.__class__ if scontext is not None else None
        if not class_obj:
            del fobj, scontext, class_obj
            return None
        # Get class properties objects
        class_props = [
            (member_name, member_obj)
            for member_name, member_obj in inspect.getmembers(class_obj)
            if isinstance(member_obj, property)
        ]
        if not class_props:
            del fobj, scontext, class_obj
            return None
        class_file = inspect.getfile(class_obj).replace(".pyc", ".py")
        class_name = self._callables_obj.get_callable_from_line(
            class_file, inspect.getsourcelines(class_obj)[1]
        )
        # Get properties actions
        prop_actions_dicts = {}
        for prop_name, prop_obj in class_props:
            prop_dict = {"fdel": None, "fget": None, "fset": None}
            for action in prop_dict:
                action_obj = getattr(prop_obj, action)
                if action_obj:
                    # Unwrap action object. Contracts match the wrapped
                    # code object while exceptions registered in the
                    # body of the function/method which has decorators
                    # match the unwrapped object
                    prev_func_obj, next_func_obj = (
                        action_obj,
                        getattr(action_obj, "__wrapped__", None),
                    )
                    while next_func_obj:
                        prev_func_obj, next_func_obj = (
                            next_func_obj,
                            getattr(next_func_obj, "__wrapped__", None),
                        )
                    prop_dict[action] = [
                        id(_get_func_code(action_obj)),
                        id(_get_func_code(prev_func_obj)),
                    ]
            prop_actions_dicts[prop_name] = prop_dict
        # Create properties directory
        func_id = id(fobj.f_code)
        desc_dict = {"fget": "getter", "fset": "setter", "fdel": "deleter"}
        for prop_name, prop_actions_dict in prop_actions_dicts.items():
            for action_name, action_id_list in prop_actions_dict.items():
                if action_id_list and (func_id in action_id_list):
                    prop_name = ".".join([class_name, prop_name])
                    del fobj, scontext, class_obj, class_props
                    return "{prop_name}({prop_action})".format(
                        prop_name=prop_name, prop_action=desc_dict[action_name]
                    )
        return None
65718
def _sp_type(self, key, value):
        """"""
        try:
            field_type = self._disp_cols[key]['type']
            if field_type in ['Number', 'Currency']:
                return value
            elif field_type == 'DateTime':
                return value.strftime('%Y-%m-%d %H:%M:%S')
            elif field_type == 'Boolean':
                if value == 'Yes':
                    return '1'
                elif value == 'No':
                    return '0'
                else:
                    raise Exception("%s not a valid Boolean Value, only 'Yes' or 'No'" % value)
            elif field_type == 'User':
                return self.users['py'][value]
            else:
                return value
        except AttributeError:
            return value
205184
public Set<Class<?>> scan() {
		for (URL url : ResourceUtil.getResourceIter(this.packagePath)) {
			switch (url.getProtocol()) {
			case "file":
				scanFile(new File(URLUtil.decode(url.getFile(), this.charset.name())), null);
				break;
			case "jar":
				scanJar(URLUtil.getJarFile(url));
				break;
			}
		}
		
		if(CollUtil.isEmpty(this.classes)) {
			scanJavaClassPaths();
		}
		
		return Collections.unmodifiableSet(this.classes);
	}