ReflectionUtils
ReflectionUtils
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Methods summary
Modifier and Type | Method |
---|---|
public | __construct ( unknown obj ) |
public static | setPropertiesByObject ( object obj , array properties , string prefix ) |
public | setProperties ( array properties , string prefix ) |
public | setProperty ( unknown name , unknown value ) |
public | activate ( ) |
public static an | createObject ( unknown class ) |
public static | setter ( object object , string name , mixed value ) |
Methods in detail
-
__construct
public __construct ( unknown obj )Create a new ReflectionUtils for the specified Object. This is done in prepartion for invoking setProperty() one or more times.param
object &$obj &$obj the object for which to set properties -
setPropertiesByObject
public static setPropertiesByObject ( object obj , array properties , string prefix )Set the properties of an object passed as a parameter in one go. The
properties
are parsed relative to a
prefix
.param
object obj The object to configure.array properties An array containing keys and values.string prefix Only keys having the specified prefix will be set. -
setProperties
public setProperties ( array properties , string prefix )Set the properites for the object that match theprefix
passed as parameter. Example: $arr['xxxname'] = 'Joe'; $arr['xxxmale'] = true; and prefix xxx causes setName and setMale.
param
array properties An array containing keys and values.string prefix Only keys having the specified prefix will be set. -
setProperty
public setProperty ( unknown name , unknown value )Set a property on this PropertySetter's Object. If successful, this method will invoke a setter method on the underlying Object. The setter is the one for the specified property name and the value is determined partly from the setter argument type and partly from the value specified in the call to this method. <p>If the setter expects a String no conversion is necessary. If it expects an int, then an attempt is made to convert 'value' to an int using new Integer(value). If the setter expects a boolean, the conversion is by new Boolean(value).param
string name name of the propertystring value String value of the property -
activate
public activate ( ) -
createObject
an public static createObject ( unknown class )Creates an instances from the given class name.param
string classnamereturn
n2n\log4php\reflection\an -
setter
public static setter ( object object , string name , mixed value )param
object objectstring namemixed value