class VariableObjectSpec extends ObjectSpec {

    /**
     * 对象变量来源,通过此来源来指定对象ID.
     * <p>
     * 此变量仅支持 fixed(固定值)和upper(来自上游)类型
     */
    private VariableSource objectSource;

    public void init(Map<String, Object> context) {<FILL_FUNCTION_BODY>}

    public void validate() {
        Assert.hasText(getObjectType(), "objectType can not be null");
        if (!StringUtils.hasText(getObjectId())) {
            Assert.notNull(objectSource, "objectSource can not be null");
            Assert.isTrue(objectSource.getSource() != VariableSource.Source.relation,
                          "unsupported source relation");
            objectSource.validate();
        }
    }

    public static VariableObjectSpec ofSource(String type, VariableSource object) {
        VariableObjectSpec spec = new VariableObjectSpec();
        spec.objectSource = object;
        spec.setObjectType(type);
        return spec;
    }

    public static VariableObjectSpec of(ObjectSpec object) {
        VariableObjectSpec spec = new VariableObjectSpec();

        spec.setObjectType(object.getObjectType());
        spec.setObjectId(object.getObjectId());
        spec.setRelated(object.getRelated());

        return spec;

    }

}

        if (objectSource != null) {
            switch (objectSource.getSource()) {
                case fixed:
                    setObjectId((String) objectSource.getValue());
                case upper:
                    DefaultPropertyFeature.GLOBAL
                        .getProperty(objectSource.getUpperKey(), context)
                        .map(String::valueOf)
                        .ifPresent(this::setObjectId);
            }
        }
    
<methods>public void <init>() ,public java.lang.String getObjectId() ,public java.lang.String getObjectType() ,public org.jetlinks.core.things.relation.RelationSpec getRelated() ,public static org.jetlinks.core.things.relation.ObjectSpec parse(java.lang.String) ,public void setObjectId(java.lang.String) ,public void setObjectType(java.lang.String) ,public void setRelated(org.jetlinks.core.things.relation.RelationSpec) ,public java.lang.String toString() <variables>private java.lang.String objectId,private java.lang.String objectType,private org.jetlinks.core.things.relation.RelationSpec related