Convenience method to query for single object by name.
 @param type (see #add)
 @param [String] name Value of the Scim object's name attribue. For naming
   attribute of each type of object see {Scim}.
 @return [String] the +id+ attribute of the object
966107
def id(type, name)
    res = ids(type, name)

    # hide client endpoints that are not scim compatible
    ik, ck = jkey(:id), jkey(:client_id)
    if type == :client && res && res.length > 0 && (res.length > 1 || res[0][ik].nil?)
      cr = res.find { |o| o[ck] && name.casecmp(o[ck]) == 0 }
      return cr[ik] || cr[ck] if cr
    end

    unless res && res.is_a?(Array) && res.length == 1 &&
        res[0].is_a?(Hash) && (id = res[0][jkey :id])
      raise NotFound, "#{name} not found in #{@target}#{type_info(type, :path)}"
    end
    id
  end
431559
def get_by_name(self, name, style_type = None):
        
        for st in self.styles.values():
            if st:
                if st.name == name:
                    return st

        if style_type and not st:
            st = self.styles.get(self.default_styles[style_type], None)            
        return st
1090017
def object( object_name )
      object = objects.find do |obj|
        obj[ 'name' ] == object_name
      end

      if !object
        raise "Database #{name} does not have an object named '#{object_name}'."
      end

      klass = PSQL.const_get object[ 'type' ].capitalize
      klass.new object[ 'name' ], name
    end
979938
private static <T> String name(T item, String name) {
    if (name != null && !name.isEmpty()) {
      return name;
    } else if (item instanceof HasMetadata) {
      HasMetadata h = (HasMetadata) item;
      return h.getMetadata() != null ? h.getMetadata().getName() : null;
    }
    return null;
  }
354903
def type
            name = (self.class.name or self.class.superclass.name or self.native_type.name)

            name.split("::").last.to_sym
        end
263222
def _get_results_by_type(self, type):
        
        instance = self._create_model_by_type(type)

        key = instance.get_key_name()

        query = instance.new_query()

        query = self._use_with_trashed(query)

        return query.where_in(key, self._gather_keys_by_type(type).all()).get()
1324589
def find_by_typename(self, typename):
        
        return self.find_by(lambda obj: type(obj).__name__ == typename)
1130355
def get_templatetype_by_name(template_id, type_name,**kwargs):
    

    try:
        templatetype = db.DBSession.query(TemplateType).filter(TemplateType.id==template_id, TemplateType.name==type_name).one()
    except NoResultFound:
        raise HydraError("%s is not a valid identifier for a type"%(type_name))

    return templatetype
588596
def field_by_name(name)
      field = fields[name.to_sym] unless name.blank?
      if field.nil?
        dotted = name.to_s.split('.')[0]
        field = fields[dotted.to_sym] unless dotted.blank?
        if field && field.key_relation.nil?
          return nil
        end
      end
      field
    end
1234666
public OSchemaHelper oIndex(String name, INDEX_TYPE type)
	{
		checkOProperty();
		return oIndex(name, type, lastProperty.getName());
	}
996593
private org.hibernate.Query query(String hql, Class<?>... type)
  {
    org.hibernate.Query q = session.createQuery(hql);
    for(int i = 0; i < positionedParameters.length; i++) {
      q.setParameter(i, positionedParameters[i]);
    }
    for(Map.Entry<String, Object> entry : namedParameters.entrySet()) {
      Object value = entry.getValue();
      if(Types.isArray(value)) {
        Object[] parameter = (Object[])value;
        if(parameter.length == 0) {
          throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey()));
        }
        q.setParameterList(entry.getKey(), parameter);
      }
      else if(Types.isCollection(value)) {
        Collection<?> parameter = (Collection<?>)value;
        if(parameter.isEmpty()) {
          throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey()));
        }
        q.setParameterList(entry.getKey(), parameter);
      }
      else {
        q.setParameter(entry.getKey(), value);
      }
    }
    if(offset > 0) {
      q.setFirstResult(offset);
    }
    if(rowsCount > 0) {
      q.setMaxResults(rowsCount);
    }

    if(type.length > 0) {
      q.setResultTransformer(Transformers.aliasToBean(type[0]));
    }
    return q;
  }
1191919
public RestQueryResult addColumn( String name,
                                      String type ) {
        if (!StringUtil.isBlank(name)) {
            columns.put(name, type);
        }
        return this;
    }
643616
function registerTypeByName(type) {
    if (registryLogger.isDebugEnabled()) {
        registryLogger.debug('Register Type \'%s\' by name [%s]', type.id, type.typeName);
    }
    typeByName[type.typeName] = type;
    return type;
}
1063489
function getTypesFrom_(block, name) {
  var typeBlock = block.getInputTargetBlock(name);
  var types;
  if (!typeBlock || typeBlock.disabled) {
    types = [];
  } else if (typeBlock.type == 'type_other') {
    types = [escapeString(typeBlock.getFieldValue('TYPE'))];
  } else if (typeBlock.type == 'type_group') {
    types = [];
    for (var n = 0; n < typeBlock.typeCount_; n++) {
      types = types.concat(getTypesFrom_(typeBlock, 'TYPE' + n));
    }
    // Remove duplicates.
    var hash = Object.create(null);
    for (var n = types.length - 1; n >= 0; n--) {
      if (hash[types[n]]) {
        types.splice(n, 1);
      }
      hash[types[n]] = true;
    }
  } else {
    types = [escapeString(typeBlock.valueType)];
  }
  return types;
}
1306225
def get_object_by_name(self, name):
        
        for obj in self.objects:
            if obj.name == name:
                return obj
        raise ValueError
1286811
public static boolean nameFilter(String type) {

        if ("date".equals(type) || "object".equals(type)) {
            return false;
        }
        return NAME_FILTER.contains(type);
    }
381530
def name_from_type(type_):
    # type: (InternalType) -> str
    
    if isinstance(type_, (DictType, ListType, TupleType, SetType, IteratorType)):
        return repr(type_)
    else:
        if type_.__name__ != 'NoneType':
            module = type_.__module__
            if module in BUILTIN_MODULES or module == '<unknown>':
                # Omit module prefix for known built-ins, for convenience. This
                # makes unit tests for this module simpler.
                # Also ignore '<uknown>' modules so pyannotate can parse these types
                return type_.__name__
            else:
                name = getattr(type_, '__qualname__', None) or type_.__name__
                delim = '.' if '.' not in name else ':'
                return '%s%s%s' % (module, delim, name)
        else:
            return 'None'