Here is best way I could experience:
<apex:component controller=”c_controller”>
<apex:attribute name=”varTEst” description=”Some parameter the controller expects.”
type=”CustomObject__c” required=”false” assignTo=”{!relatedProperty}”/>
</apex:component>
In apex class:
public class c_controller
{
public CustomObject__c relatedProperty {get; set;}
}
Now depends on how you call the component, you can even dynamically invoke the component:
CustomObject__c i = new CustomObject__c();
Component.c.ComponentName comp = new Component.c.ComponentName(relatedProperty = i);